0 Members and 1 Guest are viewing this topic.
char input[500];
memset(input, 0, bytes allocated);
Or use calloc().
malloc will return an uninitialized chunk of memory for you to use.calloc ( clear alloc ) will attempt to initialize that chunk of memory to all bits zero. Note that when I say attempt, I mean that this may not be possible so you shouldn't rely on it. Other than that the only difference is how they are called and how they are implemented. So in the end, which one you choose to use is a matter of preference.
int numInts1 = ceil(operationPos, 4);int numInts2 = ceil((inputLen - operationPos - 1), 4);int *in1 = (int*)calloc(numInts1, sizeof(int));int *in2 = (int*)calloc(numInts2, sizeof(int));
#include <os.h>int main(){ void show_msgbox("Hello World", "Hello Omnimaga"); return 0;}
Tom@AdmirableCoffee /c/Users/Tom/Desktop/Programs/Ndless/Hello_World$ makenspire-gcc -Os -nostdlib -Wall -W -marm -c main.cmain.c: In function 'main':main.c:5:10: error: expected declaration specifiers or '...' before string constantmain.c:5:10: error: expected declaration specifiers or '...' before string constantmain.c:5:10: error: expected declaration specifiers or '...' before numeric constantmake: *** [main.o] Error 1Tom@AdmirableCoffee /c/Users/Tom/Desktop/Programs/Ndless/Hello_World$