+ 1

C Calloc Fix Correct?

I found a mistake in the C teaching course and fixed it here is how i did it https://code.sololearn.com/cVS6X7en21VW/?ref=app

10th Nov 2019, 4:31 PM
Fabian G.
5 Antworten
+ 2
Fabian G. But the one in the course works fine and why do you even need to assign a size to the array when you are initializing it right there. Don't you think this works? #include <stdio.h> int main() { int arr[] = {1,2,3,4,5}; int size = sizeof(arr)/sizeof(arr[0]); for(int i=0;i<size;i++){ printf("%d ",arr[i]); } return 0; }
10th Nov 2019, 5:02 PM
Avinesh
Avinesh - avatar
+ 2
Avinesh ye ty
10th Nov 2019, 5:15 PM
Fabian G.
+ 1
Avinesh ~ swim ~ forget it it somehow didnt work now it works im just dumb
10th Nov 2019, 5:09 PM
Fabian G.
+ 1
Fabian G. Come on man that's fine. Atleast now you learnt something that hopefully you would remember.
10th Nov 2019, 5:13 PM
Avinesh
Avinesh - avatar
0
It didnt work for me in the course so i tried fixing it and then it worked for me
10th Nov 2019, 5:07 PM
Fabian G.