Course Solutions Uncategorized (Solved) : C Programming Q Implement Function Getnumbers Call Main Function Function Read One Line Fi Q26167505 . . . .

(Solved) : C Programming Q Implement Function Getnumbers Call Main Function Function Read One Line Fi Q26167505 . . . .

 

This is about C Programming.

Q.

Implement a function ‘get_numbers’ and call it in the mainfunction.
The function should read one line of the file which includesintegers,
and return an integer pointer for the integers.

– do not assume the length of array.
-read one number and use it to allocate memory space inget_numbers.
-free the memory space in the main function

I wrote some codes for the question, but it doesn’t workproplerly…

please fix my code to make it work properly.

#include <stdio.h>
#include <stdlib.h>

int *get_numbers(char filename[],int* line);

int main()
{
    int i =0;
    int *linep = NULL;
    int numArr[] = {0};

    linep =get_numbers(“hw4_2_input.txt”,linep);
    while(linep[i]!=”n”){
           numArr[i] = linep[i];
           if(linep == “n”){
               putchar(“n”);
           }else{
               printf(“%d “, numArr[i]);
           }
           i++;
        }
   

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Answered) : Describe the principal modes of product transportation–rail, air, truck, intermodal, water, package carriers, and pipeline. Pro(Answered) : Describe the principal modes of product transportation–rail, air, truck, intermodal, water, package carriers, and pipeline. Pro

Describe the principal modes of product transportation--rail, air, truck, intermodal, water, package carriers, and pipeline. Provide example of when to use each one and the disadvantages and advantages.