Applying malloc

guys... can u help me apply malloc in my code... here's my code:

struct studentinfo{
       char id[8];
       char name[30];
       char course[5];
    int i;
    FILE *stream = NULL;
    stream = fopen("studentinfo.txt", "a+");

    struct studentinfo s1;
    struct studentinfo array[3];
    for (i =0; i<1; i++){
       printf("Enter Student ID: ");
       printf("Enter Student Name: ");
       printf("Enter Student Course: ");
       scanf("%s", s1.course);

       fprintf(stream, "\n%s,\t%s,\t%s",,, s1.course);

i know malloc alots more space than the usual array... but still im having a hard time using it... thanks a lot :)


Before we help you, be sure to do this:


  • Tell us what you want to achieve;
  • Tell us what's actually happening;
  • Tell us what you've tried;
  • Tell us what's bothering you;
  • Tell us what you don't understand.

Compiler and program outputs help as well.

PS: Sort of expecting a down-vote, but that needed to be done.

Need Your Help

Fixed Legend in Google Maps Mashup

javascript html google-maps google-maps-api-2

I have a page with a Google Maps mashup that has pushpins that are color-coded by day (Monday, Tuesday, etc.) The IFrame containing the map is dynamically sized, so it gets resized when the browser

PyObject_AsReadBuffer porting issue

python c port

As we know PyObject_AsReadBuffer was changed in version2.5.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.