Q 1.
![Complete the function createStudent below: #include <stdio.h> #include <stdlib.h> struct student { char name[50]; int age; st](http://img.homeworklib.com/questions/a2ccf940-9c75-11eb-9a03-27781c8ba9bc.png?x-oss-process=image/resize,w_560)

Q 2.
if it works, I'll thumb up for u.
Q1. code:
#include<stdio.h>
#include<stdlib.h>
struct student {
char name[50];
int age;
struct student *next;
};
struct student * createStudent(char studentName[], int
studentAge)
{
struct student *temp = (struct student *)malloc(sizeof(struct
student)); //creating empty node to store the student
details.
strcpy(temp->name, studentName); //copying student name into
structure name variable.
temp->age = studentAge; //copying student age into structure age
variable.
temp->next = NULL; //storing reference next variable to
null.
return temp; //returning created node to main function.
}
int main()
{
struct student *studptr;
int myAge;
char myName[50];
scanf("%s %d", myName, &myAge);
studptr = createStudent(myName, myAge);
printf("Student %s is %d years old.\n", studptr->name,
studptr->age);
free(studptr);
return 0;
}
Image of code:

output:

Q2 code:
#include<stdio.h>
#include<stdlib.h>
struct student {
char name[50];
int age;
struct student *next;
};
struct student * createStudent(char studentName[], int
studentAge)
{
struct student *temp = (struct student *)malloc(sizeof(struct
student)); //creating empty node to store the student
details.
strcpy(temp->name, studentName); //copying student name into
structure name variable.
temp->age = studentAge; //copying student age into structure age
variable.
temp->next = NULL; //storing reference next variable to
null.
return temp; //returning created node to main function.
}
struct student * appendStudent(struct student * end, struct student
* newStrudptr)
{
end->next = newStrudptr; //giving the link to end student node
to new student node.
end = end->next; //changing the end variable to last node i.e
last student node.
return end; //returning last node.
}
int main()
{
struct student *start, *newStudptr, *end;
char name1[50], name2[50], name3[50];
int age1, age2, age3;
scanf("%s %s %s", name1, name2, name3);
scanf("%d %d %d", &age1, &age2, &age3);
start = createStudent(name1, age1);
end = start;
newStudptr = createStudent(name2, age2);
end = appendStudent(end, newStudptr);
newStudptr = createStudent(name3, age3);
end = appendStudent(end, newStudptr);
printf("Student %s is %d years old.\n", start->name,
start->age);
printf("Student %s is %d years old.\n", start->next->name,
start->next->age);
printf("Student %s is %d years old.\n",
start->next->next->name,
start->next->next->age);
return 0;
}
Image of code:
![1 2 3 4 5 #include<stdio.h> #include<stdlib.h> struct student { char name [50]; int age; struct student *next; 6 struct stude](http://img.homeworklib.com/questions/985791e0-9c77-11eb-bc20-37fcbf5e8833.png?x-oss-process=image/resize,w_560)

output:

Note: my friend if you have any questions or queries comment below. I am happy to answer your all questions. I will sort out your queries. Thank you my friend.
Q 1. Q 2. if it works, I'll thumb up for u. Complete the function createStudent...
****Using C and only C****
I have some C code that has the function addRecord, to add a
record to a linked list of records. However, when I run it, the
program exits after asking the user to input the address. See
picture below:
Here is my code:
#include<stdio.h>
#include<stdlib.h>
struct record
{
int accountno;
char name[25];
char address[80];
struct record* next;
};
void addRecord(struct record* newRecord) //Function For Adding
Record at last in a SinglyLinkedList
{
struct record *current,*start,*temp;...
Hello, I am having trouble with a problem in my C language class. I am trying to make a program with the following requirements: 1. Use #define to define MAX_SIZE1 as 20, and MAX_SIZE2 as 10 2. Use typedef to define the following struct type: struct { char name[MAX_SIZE1]; int scores[MAX_SIZE2]; } 3. The program accepts from the command line an integer n (<= 30) as the number of students in the class. You may assume that the...
Write a function to insert a name at the end of a linked list? (C) I have a linked list: struct node { char person[100]; struct node *next; }; int main() { struct node *new_node; new_node=malloc(sizeof(struct node)); printf("Please enter a name:\n"); scanf("%s", ); } How do I get the name from the user and write a function to add it to the end of the linked list? I'm not supposed to use the insert() library function, which is why I'm...
Write a statement that calls a function named IncreaseItemQty, passing the variable addStock. Assign notebookInfo with the value returned by IncreaseItemQty. #include <stdio.h> #include <string.h> typedef struct ProductInfo_struct { char itemName[30]; int itemQty; } ProductInfo; ProductInfo IncreaseItemQty (ProductInfo productToStock, int increaseValue) { productToStock.itemQty = productToStock.itemQty + increaseValue; return productToStock; } int main(void) { ProductInfo notebookInfo; int addStock = 10; scanf("%s", notebookInfo.itemName); scanf("%d", ¬ebookInfo.itemQty); /* Your solution goes here */ printf("Name:...
Combine two codes (code 1) to get names with(code 2) to get info: Code 1: #include<unistd.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<dirent.h> #include<stdio.h> #include<stdlib.h> void do_ls(char []); int main(int argc,char *argv[]) { if(argc == 1) do_ls("."); else while(--argc){ printf("%s:\n",*++argv); do_ls(*argv); } } void do_ls(char dirname[]) { DIR *dir_ptr; struct dirent *direntp; if((dir_ptr = opendir(dirname)) == NULL) fprintf(stderr,"ls1:cannot open %s\n",dirname); else { while((direntp = readdir(dir_ptr)) != NULL) printf("%s\n",direntp->d_name); closedir(dir_ptr); } } ____________________________ code 2: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> void show_stat_info(char *,...
Given the following program: #include <stdio.h> struct student { int id; char name[20]; char grade; }; void func(struct student stud); int main() { struct student astud; astud.id=9401; strcpy(astud.name, "Joe"); astud.grade = 'A'; func(astud); return 0; } Abdelghani Bellaachia, CSCI 1121 Page: 16 void func(struct student astud) { printf(" Id is: %d \n", astud.id); printf(" Name is: %s \n", astud.name); printf(" Grade is: %c \n", astud.grade); } Modify this program to include the address of a student as a separate structure....
Here is a function for some code im working on in C. Right now it accepts 2 different user inputs and stores them as city and distance. What I want is for the user to input only once. For example "Enter the city name and distance from previous city: Arlington 200". I need to separate that string into values for city and distance. I think I need to use tokens but im not sure how. void addCity () { char...
URGENT. Need help editing some C code. I have done most of the code it just needs the following added: takes an input file name from the command line; opens that file if possible; declares a C struct with three variables; these will have data types that correspond to the data types read from the file (i.e. string, int, float); declares an array of C structs (i.e. the same struct type declared in point c); reads a record from the...
Here is a serial program in C and parallel program in OpenMP that takes in a string as input and counts the number of occurrences of a character you choose. Why is the runtime for the output for the OpenMP parallel program much longer? Serial Program #include <stdio.h> #include <string.h> #include <time.h> int main(){ char str[1000], ch; int i, frequency = 0; clock_t t; struct timespec ts, ts2; printf("Enter a string: "); gets(str); int len = strlen(str); printf("Enter a character...
Need help, i can't get a infinite loop to work, that terminates when a blank line is inputted for the firstName. note: C programing langauge and using microsoft visual studios . #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #include <stdbool.h> int main() { //int arraySalaries[50]; int calculate_avg = 0; //int calculate_max; //int calculate_min; int salary[50]; //int length; //int average_salary; char firstName[50][50]; char lastName[50][50]; int i...