#include <stdio.h>
#include <string.h>
struct Student
{
char name [50]; //declare as character array with space for 50 characters
float lecture_attendance;
float lab_attendance;
};
int main(void)
{
struct Student student;
sprintf(student.name,"Jane Doe"); //use sprintf to format and store the string into the name array of the student structure.
student.lecture_attendance = 0.33f;
student.lab_attendance = 1.00f;
printf("Successful!!!");
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter