Hi, I recently started learning programming in C, I am not a programming newbie, just new to C, now here is my question:
I am experimenting with strings, because they work in an entirely different way from what I am used to, this is what i did
this is not my problem, the problem is when I try to output the string, i found a way around the problem using this:Code:int teller; int aantal = 3; int getal[aantal]; int *ptr; ptr = &getal[0]; *ptr = 1; ptr = &getal[1]; *ptr = 2; ptr = &getal[2]; *ptr = 3;
but I believer there is a better way to output it, but I can't seem to find it, I always get an error during compiling like "format '%s expects type 'char *' but argument 2 has type 'int *'Code:for (teller = 0; teller <= (aantal-1); teller++) { ptr = &getal[teller]; printf("%d",*ptr); }
any help?