Your SlideShare is downloading. ×
Structures,pointers and strings in c Programming
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Structures,pointers and strings in c Programming

665

Published on

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

  • Be the first to like this

No Downloads
Views
Total Views
665
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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

×