Quantcast
Channel: User BobbyShaftoe - Stack Overflow
Viewing all articles
Browse latest Browse all 45

Answer by BobbyShaftoe for WHY I got seg fault here? need help. Want to put integer into char pointer array

$
0
0

You did allocate space but you you are passing the wrong thing. Try this:

#include <stdio.h>#include <stdlib.h>int main(){    int num = 1;    char test[8];    sprintf(test,"%d",num);    printf("%s\n",test);}

Viewing all articles
Browse latest Browse all 45

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>