Location via proxy:
[ UP ]
[Report a bug]
[Manage cookies]
No cookies
No scripts
No ads
No referrer
Show this form
Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
32 views
C Programming Notes Part 3
c programming notes mechanical engineering semester 1 part 3
Uploaded by
Farhan Masud
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save C-Programming-Notes-Part-3 For Later
Download
Save
Save C-Programming-Notes-Part-3 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
32 views
C Programming Notes Part 3
c programming notes mechanical engineering semester 1 part 3
Uploaded by
Farhan Masud
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save C-Programming-Notes-Part-3 For Later
Carousel Previous
Carousel Next
Save
Save C-Programming-Notes-Part-3 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 24
Search
Fullscreen
1570972019 2D Aricays- > Array having 2 sub-seiipts is called 2D-ANmay. TL is also called madnix int student [4] [2] sa" subscript = coumn, Fotal v 1° subs ereipt = ¥ 0% This indicates that no. of elements = & jit shident Caltal-f{ Te en | e {amt ol, 56h> 4 vows R £ 02, 303h5 r 1 03,. 80 45 rk Loa, 98 3, 3 01, 56, 02,83, 63, 80, of, 96 | U vames assignked in memory row-wise. | each occupies 2 bytes. ig bytes occupied. *. total |\ int Student Cadlad= & 01,56, 0% 3%, 03, 60, 04) FS. even if you wreite Nake jnt student C IC2d* > The compukr will oft Undeystand that there are © 4 teows. BvT No. of coluMNs Mvs) or else, fhe computer wil) not know where fo end. Ve C4 ILA = EA 10, VI, 3! AAAS U [cal et ! ro | R-2 2 u R-3 5 im | Ihea Ta BE STATED IN THE SOBSCRIPT.‘wk main C ) Ce - (nk shedent Pad Lads Pe yas fer Cizo; bdeayiaa) i PRIPLEC” Enten Roi mo. and marek: ")5 seanf ("Za ed", D4 eipeta LILO) & ta GI LDS 5 Hoy (d= i205 ic=35 i494) i | Prantf& O° Za%d \n"s sta LI Ced, sta Li C11) 5 s return 0| | I Int main C4 | t int std Lda, int 95 fow Ci=04 i d=25 144+) ; Eten printf C™ Enter voll and matek: ")5 | | scant (%d dvd", Rota Lillolle] &std LUIEIITY i} & ota CALA IL || int main () i | Int student [ie] LT; int 35 for (iz 051 <= 925 144) & {for ix 0534-25944) becant Cy gy B student isp Ad zed", B student CHICGT5~— |] ® picogream te picint fibonaci series 13 4 7 Me = oe | Findude
#indude
Tint main () int al3e), nol Ali 7 D5 sean¢ (*%d %ad%, nolo), & nels preintf C* Enter any hoo nos a Lod = nofa] 5 ja Ci) = noltts [for Creazicios ive jf | als ati-srel-aly 5 | print e (* Fibenecisereies: “ZANE | preint® C" Fibonaci sereies fs An’ for Ciz05i
It makes fhe program easy to understand and write By Avoids the vepifitive same codes FPA self-contained biocie of -etemenis. statements that T performs a panticulan tesk. Finefon of 2 types i) Library Fanchon (‘pieintf , scanf > these functions ane \ Inbenent, present in headen fle stdio-h (1m) User-defined functor. \ Now, main focus: \| User defned functon. | ‘ [continued] Any © pirogteam contains at least functon | [ mandatory. main funchon. othenwise i+ will nok catt the. usen defined funchons | 4b 1f the funchon contains only one function, + must be | main ¢) F> If a © phogram contains more than one of them mus} be one function, main,| int main ¢) = Ree | message () 5 —> function catting printf C" Cry and stop the mountain. d; Message C }—susen defined functon. : °s printEC’ Smile and the world smiles with you. 3 [netunn 0, | \5 main C ) i printf ("J am in maind).")3 zusal )3 || Braz C)3 yer? Lo prante Cham in usa.)s 3 Brazid( ) § promt C" lam in Brarin)s $sa functon can be catied any number ef times main ) jt Messagel( ) 5 Messagex ); u | | message) message 10) } j main () A Brazile 7; pranteC Enter 3 nos "5 pseant ("Ad 7d 7d "Reale somlal & ee cate sort hl catesvm ted) , sum? cale sum ©) +, | sum pref C" Sum Za", sum); | | eate sum om)char chs printf ("%e", Rens “if Coch >= 05 AK chez a) ve turn (ch) 5 else Return (eh+34)3 5 Int a= 36 fun (n)3 printt "24" as X fun Ca +b) | £ b=cos | print? Cb)3 foreturn (bs a~print® CP am in main. main ¢ ) i ValyC) 5 Brazil C95 3 italy ¢) | printf Cl am in eaty.")5 3 Brazil () t perintt CTL am in Brraail “Js USAC)S ay us AC) yi | preintf C1 am in 05a.) 5 | Canada l)5 3 Canada ( ) 3=) A Function can be called any qumben of times, Main C) _ en 17 3 Imessage( ) 5 message 1 C) 5 Message C ) 5 message 20)5 } 3 | message ¢ ) | message 2C) Message Oi . i f || 3 a Viseaa. Lmain ¢) 3 5 ik [Brazil ls i 8 printf C" lam in diraetccint ab, Gsumy 3 eale sum (x, y,2) main ©) i print? C" Enter 3 numbers: ”)5 seant ("Za Z%d Za", Ba &b Re)S sum = cate sum Ca,b,c)5 printf C" sums %d", sum) 5 Int %Y,25 3 int dp d= nryt 2) vetutrn Cd) 5 5i 28/09/19| int main ¢) £ fmt main( ) } win not enter Link i=a0; sthe funchon display Cis [aisptay Civ] below, & vole of + win enter jhe funchon be low, display (int 3) fink x= 355 printé ("'%d ids | printé ("%d") kK); \3 This is called scope of function. yute => Locatised function. => Scope Rule of Function fun (ak ed ( \ arguments pead from funCint x, int y, int z, mt w ) ight te left, PrinlE seen from left sprintf C"%d%d Xd “a, Ha,at+) 4p reight ) 541 For Nbrahky functions, header file needed Ly 4o detenmine what kind of Vvatiables 2 WNT Wore with HW ceturnCoddidhS > printf, scan # inctude < stdio-h> err what tre of Mia rr int 1=10, 97205 of data 1 will retusn’ were work j "“add", iad} with, print "Za %d", iad5 Fist square Cer) J primt€ CZ aS ids + _ main( ) Rfloat a,b; {leat squane (float); printf C"\n Enter any number: "5 actral _angoment —> the argament sent from the calling secant C" 7", Ba)y pesqttatreta} b-square(a) 5 function, peat C*\n square of «PF is xe% a,b); % 1 the acttal ange ment Feet) oq tee ne-Chtoata) Float (Frat squane (fat x) —>catted funchon, the Runchon is t fwar yy being defhned here. Y=XR XG rete ye tunn(y); Float sqvane (Flvert *) } L » float yb yew ey veturn (uy) 5This [Void] fonction is an example main ©) of catt by ‘nothing? function | t vole Baring yy a = SS * || this function win not mefurrn any value. Ie a function doesn’t neturn any value/ digits | Wb ts by defevlt void. sa vw gt ver or Int }= 3 —>value at location, Preserve space associate name stone the value 3 mayn C$ 2 met ie35 printf CMaddress of i= %u", 215 pring $C'An value of i= %d "515@ vatue at address operaky / Scope Rute RA Indinection operator. Functions- —————— = Se ——_ . cal) by Value > a variable main C ) is local fon the funchon .... Carb) { it a=10,b=20, fanchon it 49 swapy (a,b), —s catling function. oy ee only send PYINEF C"\n aze%d and be %d 7s 4b)? a value } fo another swapv (int x, int y) > cated function. function. © Lint *& t= 45 X= Yd feb: printf OC" \n xe %dsyeZd yds 3 | what i> the wesulk on the screen.- X=20 , ¥=10 a=po and 6-20 > cail by refenence Aan by addiress,a |main ¢) Vine Q=10, br a0, > address /R : VC Ra, KbIS Leal by (apy Carb}; swap ive fereence FPFIMEE CC” \n ex d and be ud", Rab) a3 | swapy Cint Ta omt Fy) cee it int t3 | b= &y; || tea dys | tyeby | PMLFC nm, Zayed”, wy); 3 (fn © the potential to change dhe Siginal value of @ and b. | a= 20, b=10 } Sand b ecway the varues x? 20, b=lo of uM ond y Tespectively,main () a int radius, == — | Float area, cremference perimeters scant (“Za & radivs)), ae “areal radivs, &radix & arco, & & peivimetiy ) preint£C" Area= ZF") area) print # C" Petrimeten = Z6%, perimeter) 5 aneapers Cink vr, float a, feat * p) t “ae Blu K BANS APS Qa dK TS 3 no need to veturn the Value when sing an addivess operator, i+ will return the values by defavit. —if you declare a pointer, main ) Line i, int #55 you musk point on the +f other Vaniable 13> Rij —Smeane Dwi pan ah ae printhCpdd oti [print C"\n Value of 4 print® C\n ada of 2 44% BIDS 65524 Adddess Z~da); 6dbay Address printf C"\n vatue of 9= 7d", X(ea))) Cosa primteC "An Zd"\3)5 coeay printe C" %d", 4), 5 3 printf ("Ad") ® 4), 3 Adovalue at add vers of pointer J Pot 1 | 3 | [esau 6b5aA4 65520. | main ©) mt tsi James tes3 ouble ponte} Ponts ONGt han 1 i 4 Nyt Pointer. d= &i5 Ke Ra) 4 PrinthC"\n 4d", &1), CH5X4Y — addvess of | printf C"\y %4", 4); obey " print# ("tn 2a" 24), 65524 printt C" \n xd "ay); 6520 printh (" Ad", k), co5ap Prineh ("4d Rk) emare printf C"79","@ i); 3 Print $C" Zg", 43), 3 Printf C" zd", tek); 3 i 1 ek ji 4 La | fobay eine] value (pointer) SPP 65522 come addiness (address operator) printf ("2d 9464) > points af 3 444 pon Gonay #Y 3 Gbd20Sim =— chi av ramel 1=1'P’, | PROGRAM \\ | | k vod v 5524 65523 memory address. J chan name L \ =" progsam | > main ©) ° a v v GHAR AL 3 chon name J>% program *; || int 1205 white (i <= 4) V4 printf ("Ze") nameLil); | it4y) ab ee a nuit chanaeter (imp. +» mention) R n M bo voy a6 (718 “VR= main) 4 char namel 1 “program” ine \| septs Cname LiT4= '\o') — becavse all strings have a pull If printe O%c', namel1T)s characte) O at the end sey 5 iets 3 — nem uo) { char name t Y=" program”, | char * p; 3 | name|—s base address | P=name | while (*1p1="\o") sohan type van ¢ Cro address) A printhC"%e" &p)s [eben combp) ‘omly mention base Piety addvess Sor =dhany \| 3 Nariable pointers. cause We aPe poining the Memory address, |The memeny addness 1s shifting to the sight ond ¥p points the Value at that memody address euch hme.
You might also like
C Language {Unit 2(Part 1)}[1]
PDF
No ratings yet
C Language {Unit 2(Part 1)}[1]
20 pages
Basic Handnote of CSE-101 Course
PDF
No ratings yet
Basic Handnote of CSE-101 Course
43 pages
unit 4 pps
PDF
No ratings yet
unit 4 pps
11 pages
C-Programming ShortNotes
PDF
No ratings yet
C-Programming ShortNotes
7 pages
Byts Week - 4
PDF
No ratings yet
Byts Week - 4
18 pages
DSA notes (1)
PDF
No ratings yet
DSA notes (1)
18 pages
Gate C Notes
PDF
No ratings yet
Gate C Notes
141 pages
Functions in C ?
PDF
No ratings yet
Functions in C ?
11 pages
C Notes
PDF
No ratings yet
C Notes
241 pages
DS C++ Record 1st Exercise To 6 TH Exsrcise
PDF
No ratings yet
DS C++ Record 1st Exercise To 6 TH Exsrcise
22 pages
C Programming
PDF
No ratings yet
C Programming
42 pages
C Language Notes-2
PDF
No ratings yet
C Language Notes-2
40 pages
10th Computer FLPs
PDF
No ratings yet
10th Computer FLPs
10 pages
CPR CT2 Question Bank
PDF
No ratings yet
CPR CT2 Question Bank
9 pages
CP Important Question Bank Which Can Come
PDF
No ratings yet
CP Important Question Bank Which Can Come
32 pages
PSTC Unit-4
PDF
No ratings yet
PSTC Unit-4
9 pages
DocScanner Mar 1, 2024 00-59
PDF
No ratings yet
DocScanner Mar 1, 2024 00-59
11 pages
Programming Keys
PDF
No ratings yet
Programming Keys
20 pages
C-Language Cheat Sheet
PDF
No ratings yet
C-Language Cheat Sheet
5 pages
10. Assignment No. 4
PDF
No ratings yet
10. Assignment No. 4
9 pages
UNIT-1_PSTC
PDF
No ratings yet
UNIT-1_PSTC
25 pages
CPP Notes - 01
PDF
No ratings yet
CPP Notes - 01
30 pages
Algorithm SC 2006
PDF
No ratings yet
Algorithm SC 2006
138 pages
Assignment 4
PDF
No ratings yet
Assignment 4
7 pages
Arrays - Class 1
PDF
No ratings yet
Arrays - Class 1
13 pages
CP_Unit_-05[1]
PDF
No ratings yet
CP_Unit_-05[1]
25 pages
Yung-Hsiang Lu - Intermediate C Programming - 2015
PDF
No ratings yet
Yung-Hsiang Lu - Intermediate C Programming - 2015
494 pages
MODULE 3 Functions. E-Note
PDF
No ratings yet
MODULE 3 Functions. E-Note
78 pages
Gagan Parmar Unit 3 c Language
PDF
No ratings yet
Gagan Parmar Unit 3 c Language
30 pages
C Programming Notes Part 2
PDF
No ratings yet
C Programming Notes Part 2
24 pages
(Ebook) Programming, problem solving & abstraction with C by Moffat, Alistair ISBN 9781486010974, 1486010970 - Download the ebook in PDF with all chapters to read anytime
PDF
100% (1)
(Ebook) Programming, problem solving & abstraction with C by Moffat, Alistair ISBN 9781486010974, 1486010970 - Download the ebook in PDF with all chapters to read anytime
56 pages
PPS Class Notes.3
PDF
No ratings yet
PPS Class Notes.3
32 pages
C&Matlab Primer
PDF
No ratings yet
C&Matlab Primer
412 pages
C Language Notes-1
PDF
No ratings yet
C Language Notes-1
41 pages
OOP Notes
PDF
No ratings yet
OOP Notes
24 pages
Programming For Problem Solving Using C and C RBU
PDF
No ratings yet
Programming For Problem Solving Using C and C RBU
69 pages
Full Course
PDF
No ratings yet
Full Course
5 pages
Structure of C' Program
PDF
No ratings yet
Structure of C' Program
16 pages
Lect-03-Variables and Datatypes
PDF
No ratings yet
Lect-03-Variables and Datatypes
31 pages
Review of Structured Programming in C
PDF
No ratings yet
Review of Structured Programming in C
64 pages
C Programming Notes Part 1
PDF
No ratings yet
C Programming Notes Part 1
24 pages
C Programming Notes Part 4
PDF
No ratings yet
C Programming Notes Part 4
16 pages
Unit 3 (PSTC)
PDF
No ratings yet
Unit 3 (PSTC)
14 pages
C Language
PDF
No ratings yet
C Language
57 pages
c programming
PDF
No ratings yet
c programming
172 pages
4
PDF
No ratings yet
4
7 pages
Photo_compressed
PDF
No ratings yet
Photo_compressed
64 pages
C Programming Language
PDF
No ratings yet
C Programming Language
55 pages
صالح محمد أحمد2
PDF
No ratings yet
صالح محمد أحمد2
11 pages
C Programming and Data Structures Notes Sample Compressed
PDF
No ratings yet
C Programming and Data Structures Notes Sample Compressed
8 pages
Cprogram Final Lab Manual
PDF
No ratings yet
Cprogram Final Lab Manual
26 pages
Array Level - 3
PDF
No ratings yet
Array Level - 3
16 pages
C Programming Lab
PDF
No ratings yet
C Programming Lab
39 pages
The C - Language Reference Manual: Simon Peyton Jones Thomas Nordin Dino Oliva Pablo Nogueira Iglesias April 23, 1998
PDF
No ratings yet
The C - Language Reference Manual: Simon Peyton Jones Thomas Nordin Dino Oliva Pablo Nogueira Iglesias April 23, 1998
34 pages
3 - Intro To C - Constants Var Datatypes
PDF
No ratings yet
3 - Intro To C - Constants Var Datatypes
50 pages
WINSEM2023-24 BCSE102L TH VL2023240501145 2024-01-05 Reference-Material-I
PDF
No ratings yet
WINSEM2023-24 BCSE102L TH VL2023240501145 2024-01-05 Reference-Material-I
42 pages
Pds Practice Questions
PDF
No ratings yet
Pds Practice Questions
190 pages
Understanding Assembly Language- 0Reverse Engineering for -- Dennis Yurichev -- 2021 -- 47c19d56d33b67023699efb925af6ae3 -- Anna’s Archive
PDF
No ratings yet
Understanding Assembly Language- 0Reverse Engineering for -- Dennis Yurichev -- 2021 -- 47c19d56d33b67023699efb925af6ae3 -- Anna’s Archive
1,365 pages