Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
docu...
Week Target Achieved
1
2
3
4 20 13
5 20 16
6 20 16
Typing Speed
Jobs Applied
Week Company Designation Applied Date Current Status
1
2
3
STRUCTURES,POINTERS AND STRINGS IN C
Febila v e a
fabilavea@gmail.com
STRUCTURES
• Structure is the collection of variables of
different types under a single name for better
handling.
Syntax of structure
struct structure_name
{
data_type member1;
data_type member2;
.
.
data_type memeber;
};
EXAMPLE#include<stdio.h>
struct student
{
char name[10];
int age;
};
int main()
{
int n,i;
struct student std[10];
printf(...
POINTERS
• A pointer is a variable whose value is the address of
another variable, i.e., direct address of the memory
loca...
Example
#include<stdio.h>
void main()
{
int a,*p;
printf("nEnter the number");
scanf("%d",&a);
p=&a;
printf("%d%d",p,&a); ...
STRINGS
• Strings in C are represented by arrays of
characters.
• The end of the string is marked with a special
character...
Example
#include<stdio.h>
void main()
{
char a[7]="baabtra";
scanf("%s",&a);
printf("%s",a);
}
Structures,pointers and strings in c Programming
Upcoming SlideShare
Loading in …5
×

Structures,pointers and strings in c Programming

1,238 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,238
On SlideShare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
Downloads
35
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Structures,pointers and strings in c Programming

  1. 1. 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
  2. 2. Week Target Achieved 1 2 3 4 20 13 5 20 16 6 20 16 Typing Speed
  3. 3. Jobs Applied Week Company Designation Applied Date Current Status 1 2 3
  4. 4. STRUCTURES,POINTERS AND STRINGS IN C Febila v e a fabilavea@gmail.com
  5. 5. STRUCTURES • Structure is the collection of variables of different types under a single name for better handling.
  6. 6. Syntax of structure struct structure_name { data_type member1; data_type member2; . . data_type memeber; };
  7. 7. 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); } }
  8. 8. 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;
  9. 9. Example #include<stdio.h> void main() { int a,*p; printf("nEnter the number"); scanf("%d",&a); p=&a; printf("%d%d",p,&a); //memory address Printf(“%d%d”,*p,a); //value }
  10. 10. 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.
  11. 11. Example #include<stdio.h> void main() { char a[7]="baabtra"; scanf("%s",&a); printf("%s",a); }

×