So I need help with my homework, please help if you can;
I recently started a class that requires I know C, but the prerequisite classes that I took for that class taught C++, weird, but anyway since I don't understand C, I was wondering if you guys can help out.
I've tried learning C, but I can't get some of the stuff.
The first question asks:
and..this is my attempt..a.1) to create a size n array of integer items by reading the values from the
keyboard
Not sure what's happening, but the program crashes after enter two chars.Code:#include<stdio.h> int main() { int n; printf("how many keys?\n"); getchar(); n=getchar(); int keys[n]; scanf("%d",&n); printf(n); getchar(); return 0; }
P.S I'm not trying to get an easy answer, I want to be able to master this stuff so I can return the favor
Thanks for reading~ Hopefully you guys can help.