TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
Structures,pointers and strings in c Programming
1.
2. Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
8. EXAMPLE#include<stdio.h>
struct student
{
char name[10];
int age;
};
int main()
{
int n,i;
struct student std[10];
printf("enter the no.of stusdent:");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the details of student%dn",i+1);
printf("enter the namet");
scanf("%s",std[i].name);
printf("enter the aget");
scanf("%d",&std[i].age);
}
printf("NAMEtAGEn");
for(i=0;i<n;i++)
{
printf("%st",std[i].name);
printf("%dtn",std[i].age);
}
}
9. POINTERS
• A pointer is a variable whose value is the address of
another variable, i.e., direct address of the memory
location.
• Like any variable or constant, you must declare a
pointer before you can use it to store any variable
address.
The general form of a pointer variable declaration is:
• type *var-name;
11. STRINGS
• Strings in C are represented by arrays of
characters.
• The end of the string is marked with a special
character, the null character.
• Which is simply the character with the value
0.