Array | Sololearn: Learn to code for FREE!



#include <stdio.h> #include <stdlib.h> int  main() { int i, arr[5] = {25, 30, 35, 40, 55}; for( i=0; i<5; i++) { printf("%d   ", *arr); arr++; /* 'main':| 9|error: lvalue required as increment operand| */ } return 0; }

10/20/2019 8:13:01 AM

simi sam

10 Answers

New Answer


arr is an array of 5 int not a pointer. You cannot increment an array like that. If you want to print data using pointers then do this int *ptr = arr; printf("%d ", *ptr); ptr++; You can directly write *p++


simi sam You are Welcome 👍☺ And I am fine without 'sir'


simi sam Sololearn certificates are not yet valid. It is given just given as a proof for completion of course


Thank you sir


Ok thanks


Is it a valid certificate for interviews by going through solo learn


Could you answer


Do I need certification simi sam Please, Use the 🔍SEARCH... bar future!


As you have done in solo learn


Or u can- int i, arr[5]={25,30,35,40,55}; for (i=0; i<5; i++){ printf("%d", arr[i]); }