Outline. Pointers arithme.c and others Func.ons & pointers

Size: px
Start display at page:

Download "Outline. Pointers arithme.c and others Func.ons & pointers"

Transcription

1 Pointers II 1

2 Outline Pointers arithme.c and others Func.ons & pointers 2

3 Pointer Arithme/c When you add to or subtract from a pointer, the amount by which you do that is mul/plied by the size of the type the pointer points to. In the case of our three increments, each 1 that you added was mul.plied by sizeof(int). int array[] = { 45, 67, 89 }; int *array_ptr = array; prinh(" first element: %i\n", *(array_ptr++)); 1 prinh("second element: %i\n", *(array_ptr++)); prinh(" third element: %i\n", *array_ptr); Output: first element: 45 second element: 67 third element: 89 NOTE 1: 1==4 (programmer humor?!) *(array_ptr++) == *array_ptr++ B T W *(array_ptr++) 1 vs (*array_ptr)++ find the value at that address, output, then add 1 to the address VS Find the value at the address, output, then add one to the value at that address

4 Pointer Arithme/c (cont) Expression Assuming p is a pointer to a and the size of *p is Value added to the pointer p+1 char 1 1 p+1 short 2 2 p+1 int 4 4 p+1 double 8 8 p+2 char 1 2 p+2 short 2 4 p+2 int 4 8 p+2 double

5 Pointer Arithme/c (again) pointer (+ or - ) integer Only for pointers that are poin.ng at an element of an array Also works with malloc Watch for bounds (begin and end) Ok to go one beyond the array but not a valid dereference pointer#2 pointer#1 Only allowed when both point to elements of the same array and p1 index < p2 index Measured in array elements not bytes If p1 à array[i] and p2 à array[j] then p2- p1 == j - i 5

6 Pointer Indexing int array[] = { 45, 67, 89 }; prinh("%i\n", array[0]); // output is 45 prinh("%i\n", *array); // output is 45 // *array and array[0] mean same thing int array[] = { 45, 67, 89 }; int *array_ptr = &array[1]; prinh("%i\n", array_ptr[1]); //output is 89 (whoooooooaaaahhhhff??!!) array points to the first element of the array; array[1] == *(array + 1) array_ptr is set to &array[1], so it points to the second element of the array. So array_ptr[1] is equivalent to array[2] 6

7 NULL vs 0 vs \0 NULL is a macro defined in several standard headers 0 is an integer constant '\0' is a character constant, and nul is the name of the character constant. All of these are *not* interchangeable NULL is to be used for pointers only since it may be defined as ((void *) 0), this would cause problems with anything but pointers. 0 can be used anywhere, it is the generic symbol for each type's zero value and the compiler will sort things out. '\0' should be used only in a character context. nul is not defined in C or C++, it shouldn't be used unless you define it yourself in a suitable manner, like: #define nul '\0' 7

8 R and L values L- value = something that can appear on the lee side of an equal sign A place i.e. memory loca.on for a value to be stored R- value is something that can appear on the right side of an equal sign A value Example: a = b+25 vs b+25 = a Example: int a[30]; a[b+10]=0; Example: int a, *pi; pi = &a; *pi = 20; 8

9 R and L values (cont) Given: char ch = a ; char *cp = &ch; NOTE: the? is the loca/on that follows ch cp ch a? Problem Expression R- value L- value 1 ch yes yes 2 &ch yes illegal 3 cp yes yes 4 &cp yes illegal 5 *cp yes yes 6 *c+1 yes illegal 7 *(c+1) yes yes 8 ++cp yes illegal 9 cp++ yes illegal 10 *++cp yes yes 11 *cp++ yes yes 12 ++*cp yes illegal 13 (*cp)++ yes illegal 14 ++*++cp yes illegal 15 ++*cp++ yes illegal 9

10 An Array of Character Pointers #include<stdio.h> int main() { // Declaring/Ini/alizing 3 characters pointers char *ptr1 = "Himanshu"; char *ptr2 = "Arora"; char *ptr3 = "TheGeekStuff"; //Declaring an array of 3 char pointers char* arr[3]; // Ini/alizing the array with values arr[0] = ptr1; arr[1] = ptr2; arr[2] = ptr3; //Prin/ng the values stored in array prinh("\n [%s]\n", arr[0]); prinh("\n [%s]\n", arr[1]); prinh("\n [%s]\n", arr[2]); return 0; } 10

11 Pointers to Arrays <data type> (*<name of ptr>)[<an integer>] Declares a pointer ptr to an array of 5 integers. int(*ptr)[5]; #include<stdio.h> int main(void) { char arr[3]; char (*ptr)[3]; arr[0] = 'a'; arr[1] = 'b'; arr[2] = 'c'; ptr = &arr; return 0; } Declares and ini/alizes an array arr and then declares a pointer ptr to an array of 3 characters. Then ini/alizes ptr with the address of array arr. int *arr[8]; int (*arr)[8]; // An array of int pointers. // A pointer to an array of integers 11

12 Outline Pointers arithme.c and others Func.ons & pointers 12

13 Func/on defini/on Func.on prototype Return type* Argument defini.on return_type func.on_name (type1 arg1,type2 arg2,..,typen argn) Func.on calls Basic syntax z = add(a,b); Parameter passing* Standard library and func.on calls NOTES: Ø Functions should be short and sweet. int add(int p,int q) Ø Functions do not nest. { Ø Variables have to be communicated through function return p+q; arguments or global variables. } Ø * If no return type or no argument type, then it defaults to int Sample: hop:// int add(int p,int q); 13

14 Func/on Prototypes A number of statements grouped into a single logical unit are called a func.on REMINDER è It is necessary to have a single func.on main in every C program. A func.on prototype is a func.on declara.on or defini.on which includes: Informa.on about the number of arguments Informa.on about the types of the arguments Although you are allowed not to specify any informa.on about a func.on's arguments in a declara.on, it is purely because of backwards compa.bility with Old C and should be avoided (poor coding style). A declara.on without any informa.on about the arguments is not a prototype. Only one func.on with a given name may be defined. Unlike C++, C does not support overloading (i.e., two func.ons with the same name but different signatures). 14

15 The RETURN statement Every func.on except those returning void should have at least one, each return showing what value is supposed to be returned at that point. Although it is possible to return from a func.on by falling through the last }, unless the func.on returns void, an unknown value will be returned, resul.ng in undefined behavior. The type of expression returned must match the type of the func.on, or be capable of being converted to it as if an assignment statement were in use. Following the return keyword with an expression is not permioed if the func.on returns void. 15

16 Pointers and Func/ons Pass By Value Passing a variable by value makes a copy of the variable before passing it onto a func.on. This means that if you try to modify the value inside a func.on, it will only have the modified value inside that func.on. Once the func.on returns, the variable you passed it will have the same value it had before you passed it into the func.on. Pass By Reference There are two instances where a variable is passed by reference: When you modify the value of the passed variable locally (inside the callee) and the value of the variable in the calling func.on as well. To avoid making a copy of the variable for efficiency reasons. Technically, C does not pass by reference as typically seen in other programming languages. Actually, when you pass a pointer (an address), a copy is made of that variable so two variables point to the same address (one from the callee and one from the caller). 16

17 Pointers and Func/on arguments Call: swap(a,b); /* WRONG */ void swap(int x, int y) { int temp; temp = x; x = y; y = temp; } Call: swap(&a,&b); /* interchange *px and *py */ void swap(int *px, int *py) { int temp; temp = *px; *px = *py; *py = temp; } Since C passes arguments to func.ons by value and make a copy local to swap; so there is no direct way for the called func.on (callee) to alter a variable in the calling func.on (caller). Because of call by value, swap can t affect the arguments a and b in the rou.ne that called it. The way to obtain the desired effect is for the calling program to pass pointers to the values to be changed: Since the operator & produces the address of a variable, &a is a pointer to a. In swap itself, the parameters are declared as pointers, and the operands are accessed indirectly through them. NOW KNOW WHY SCANF NEEDS & SYMBOLS!!! 17

18 Func/on example #include <stdio.h> #include <stdlib.h> void prinfotal(int total); void addxy(int x, int y, int total); void subxy(int x, int y, int *total); void main() { int x, y, total; x = 10; y = 5; total = 0; prinfotal(total); addxy(x, y, total); prinfotal(total); subxy(x, y, &total); prinfotal(total); } Program con/nued void prinfotal(int total) { prinh("total in Main: %dn", total); } void addxy(int x, int y, int total) { total = x + y; prinh("total from inside addxy: %dn", total); } void subxy(int x, int y, int *total) { *total = x - y; prinh("total from inside subxy: %dn", *total); } 18

19 A Func/on example #include <stdio.h> #include <stdlib.h> void date(int *, int *); /* declare the func/on */ main() { int month, day; date (&day, &month); prinh("day is %d, month is %d\n", day, month); return 0;} void date(int *day_p, int *month_p) { int day_ret, month_ret; /* * At this point, calculate the day and month * values in day_ret and month_ret respec/vely. */ *day_p = day_ret; *month_p = month_ret; } 19

20 Func/on Summary Func.ons can be called recursively. Func.ons can return any type that you can declare, except for arrays and func.ons (you can get around that restric.on to some extent by using pointers). Func.ons returning no value should return void. Always use func.on prototypes. Undefined behavior results if you call or define a func.on anywhere in a program unless either a prototype is always in scope for every call or defini.on, or you are very, very careful. Assuming that you are using prototypes, the values of the arguments to a func.on call are converted to the types of the formal parameters exactly as if they had been assigned using the = operator. Func.ons taking no arguments should have a prototype with (void) as the argument specifica.on. 20

21 Func/on pointers Func.on codes are also stored in the memory Func.on pointers are pointers poin.ng to the start address of the func.on codes Func.on pointers can be passed as parameters or returned as return value Simple example: #include <stdio.h> void my_int_func(int x) { prin}( "%d\n", x ); } int main() { void (*foo)(int); /* the ampersand is actually op.onal */ foo = &my_int_func; Int a = 1; (*foo)(a); return 0; } 21

22 Why do we need func/on pointers? Run.me binding useful when alterna.ve func.ons maybe used to perform similar tasks on data (eg sor.ng) Determine sor.ng func.on based on type of data at run.me Eg: inser.on sort for smaller data sets (n <100) Eg: Quicksort for large data sets ( n > ) Other sor.ng algorithms based on type of data set One common use is in passing a func.on as a parameter in a func.on call Greater flexibility and beoer code reuse 22

23 Func/on Pointer Declara/ons A func.on pointer is nothing else than a variable, it must be defined as usual. Eg, int (*funcpointer) (int, char, int); The extra parentheses around (*funcpointer) is needed because there are precedence rela.onships in declara.on just as there are in expressions 23

24 Func/on Pointer Assignment It is op.onal to use the address operator & in front of the func.on s name When you men.on the name of a func.on but are not calling it, there is nothing else you could possibly be trying to do except for genera.ng a pointer to it Similar to the fact that a pointer to the first element of an array is generated automa.cally when an array appears in an expression 24

25 Func/on Pointer Assignment Example //Declare a func.on pointer int (*funcpointer) (int, char, int); int assignexample ( int a, char b, int c){ prin}( Welcome to the assignment example ); return a+b+c; } int main(){ funcpointer= assignexample; //assignment funcpointer=&assignexample; //alterna.ve using address operator return 0; } 25

26 Calling a func/on by Func/on Pointer There are two alterna.ves ü Use the name of the func.on pointer ü Can explicitly dereference it int (*funcpointer) (int, char, int); // calling a func.on using func.on pointer int answer= funcpointer (7, A, 2 ); int answer=(* funcpointer) (7, A, 2 ); 26

27 Arrays of Func/on Pointers C treats pointers to func.ons just like pointers to data therefore we can have arrays of pointers to func.ons This offers the possibility to select a func.on using an index ü ü Eg. Suppose that we re wri.ng a program that displays a menu of commands for the user to choose from. We can write func.ons that implement these commands, then store pointers to the func.ons in an array: 27

28 Arrays of Func/on Pointers Example void (*file_cmd[]) (void) = { new_cmd, open_cmd, close_cmd, save_cmd, save_as_cmd, print_cmd, exit_cmd }; If the user selects a command between 0 and 6, then we can subscript the file_cmd array to find out which func.on to call file_cmd[n](); 28

29 Sort Example In <stdlib.h>, we have a sor.ng func.on: void qsort ( void *base, size_t num, size_t size, int (*comp_func) (const void *, const void *)) Consists of three parts ü ü ü a comparison that determines the ordering of any pair of objects an exchange that reverses their order A sor.ng algorithm that makes comparisons and exchange un.l the objects are in order. <the sor.ng algorithm is independent of comparison and exchange operator> qsort will sort an array of elements. This is a wild func.on that uses a pointer to another func.on that performs the required comparisons. 29

30 Sort Example In <stdlib.h>, we have a sor.ng func.on: void qsort ( void *base, size_t num, size_t size, int (*comp_func) (const void *, const void *)) Some explana.on ü ü ü ü void * base is a pointer to the array to be sorted. This can be a pointer to any data type size_t num The number of elements. size_t size The element size. int (*comp_func)(const void *, const void *))This is a pointer to a func.on. 30

31 Sort Example qsort thus maintains it's data type independence by giving the comparison responsibility to the user. The compare func.on must return integer values according to the comparison result: ü ü ü less than zero : if first value is less than the second value zero : if first value is equal to the second value greater than zero : if first value is greater than the second value Some quite complicated data structures can be sorted in this manner. The generic pointer type void * is used for the pointer arguments, any pointer can be cast to void * and back again without loss of informa.on. 31

32 #include <stdlib.h> int int_sorter( const void *first_arg, const void *second_arg ){ int first = *(int*)first_arg; int second = *(int*)second_arg; if ( first < second ) { return -1; } else if ( first == second ) { return 0; } else { return 1; } } int main() { int array[10]; int i; /* fill array */ for ( i = 0; i < 10; ++i ) { array[ i ] = 10 - i; } qsort( array, 10, sizeof( int ), int_sorter ); for ( i = 0; i < 10; ++i ) { printf ( "%d\n",array[ i ] ); } } 32

33 References The C Programming Language, Brian W.Kernighan, Dennis M.Ritchie hop:// pointers.html 33

/* EXAMPLE 1 */ #include<stdio.h> int main() { float i=10, *j; void *k; k=&i; j=k; printf("%f\n", *j);

/* EXAMPLE 1 */ #include<stdio.h> int main() { float i=10, *j; void *k; k=&i; j=k; printf(%f\n, *j); You try /* EXAMPLE 3 */ #include int main(void) { char ch = 'c'; char *chptr = &ch; int i = 20; int *intptr = &i; float f = 1.20000; float *fptr = &f; char *ptr = "I am a string"; /* EXAMPLE

More information

Memory layout. int foo() { int b; } int main() { int a; foo(); Program. Stack. Heap. foo: int b main: int a

Memory layout. int foo() { int b; } int main() { int a; foo(); Program. Stack. Heap. foo: int b main: int a Function Pointers Memory layout int foo() { int b; } int main() { int a; foo(); } compile main:.lfb6: pushq %rbp.lcfi2: movq %rsp, %rbp.lcfi3: subq $32, %rsp.lcfi4: movl %edi, -20(%rbp) movq %rsi, -32(%rbp)

More information

by Pearson Education, Inc. All Rights Reserved.

by Pearson Education, Inc. All Rights Reserved. Let s improve the bubble sort program of Fig. 6.15 to use two functions bubblesort and swap. Function bubblesort sorts the array. It calls function swap (line 51) to exchange the array elements array[j]

More information

Intermediate Programming, Spring 2017*

Intermediate Programming, Spring 2017* 600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general

More information

Procedural programming with C

Procedural programming with C Procedural programming with C Dr. C. Constantinides Department of Computer Science and Software Engineering Concordia University Montreal, Canada August 11, 2016 1 / 77 Functions Similarly to its mathematical

More information

Language comparison. C has pointers. Java has references. C++ has pointers and references

Language comparison. C has pointers. Java has references. C++ has pointers and references Pointers CSE 2451 Language comparison C has pointers Java has references C++ has pointers and references Pointers Values of variables are stored in memory, at a particular location A location is identified

More information

Pointers (part 1) What are pointers? EECS We have seen pointers before. scanf( %f, &inches );! 25 September 2017

Pointers (part 1) What are pointers? EECS We have seen pointers before. scanf( %f, &inches );! 25 September 2017 Pointers (part 1) EECS 2031 25 September 2017 1 What are pointers? We have seen pointers before. scanf( %f, &inches );! 2 1 Example char c; c = getchar(); printf( %c, c); char c; char *p; c = getchar();

More information

Pointer Basics. Lecture 13 COP 3014 Spring March 28, 2018

Pointer Basics. Lecture 13 COP 3014 Spring March 28, 2018 Pointer Basics Lecture 13 COP 3014 Spring 2018 March 28, 2018 What is a Pointer? A pointer is a variable that stores a memory address. Pointers are used to store the addresses of other variables or memory

More information

Arrays and Pointers in C. Alan L. Cox

Arrays and Pointers in C. Alan L. Cox Arrays and Pointers in C Alan L. Cox alc@rice.edu Objectives Be able to use arrays, pointers, and strings in C programs Be able to explain the representation of these data types at the machine level, including

More information

Lecture 10: Potpourri: Enum / struct / union Advanced Unix #include function pointers

Lecture 10: Potpourri: Enum / struct / union Advanced Unix #include function pointers ....... \ \ \ / / / / \ \ \ \ / \ / \ \ \ V /,----' / ^ \ \.--..--. / ^ \ `--- ----` / ^ \. ` > < / /_\ \. ` / /_\ \ / /_\ \ `--' \ /. \ `----. / \ \ '--' '--' / \ / \ \ / \ / / \ \ (_ ) \ (_ ) / / \ \

More information

Why Pointers. Pointers. Pointer Declaration. Two Pointer Operators. What Are Pointers? Memory address POINTERVariable Contents ...

Why Pointers. Pointers. Pointer Declaration. Two Pointer Operators. What Are Pointers? Memory address POINTERVariable Contents ... Why Pointers Pointers They provide the means by which functions can modify arguments in the calling function. They support dynamic memory allocation. They provide support for dynamic data structures, such

More information

Func%ons. CS449 Fall 2017

Func%ons. CS449 Fall 2017 Func%ons CS449 Fall 2017 1 Func%ons in C A group of statements performing a task Statements inside func%on is executed by calling it using the () operator Uses: Readability (through code modulariza%on)

More information

CS 61C: Great Ideas in Computer Architecture. C Arrays, Strings, More Pointers

CS 61C: Great Ideas in Computer Architecture. C Arrays, Strings, More Pointers CS 61C: Great Ideas in Computer Architecture C Arrays, Strings, More Pointers Instructor: Justin Hsia 6/20/2012 Summer 2012 Lecture #3 1 Review of Last Lecture C Basics Variables, Functions, Flow Control,

More information

Arrays and Pointers. CSE 2031 Fall November 11, 2013

Arrays and Pointers. CSE 2031 Fall November 11, 2013 Arrays and Pointers CSE 2031 Fall 2013 November 11, 2013 1 Arrays l Grouping of data of the same type. l Loops commonly used for manipulation. l Programmers set array sizes explicitly. 2 Arrays: Example

More information

C: Pointers. C: Pointers. Department of Computer Science College of Engineering Boise State University. September 11, /21

C: Pointers. C: Pointers. Department of Computer Science College of Engineering Boise State University. September 11, /21 Department of Computer Science College of Engineering Boise State University September 11, 2017 1/21 Pointers A pointer is a variable that stores the address of another variable. Pointers are similar to

More information

Lab 3. Pointers Programming Lab (Using C) XU Silei

Lab 3. Pointers Programming Lab (Using C) XU Silei Lab 3. Pointers Programming Lab (Using C) XU Silei slxu@cse.cuhk.edu.hk Outline What is Pointer Memory Address & Pointers How to use Pointers Pointers Assignments Call-by-Value & Call-by-Address Functions

More information

CS113: Lecture 5. Topics: Pointers. Pointers and Activation Records

CS113: Lecture 5. Topics: Pointers. Pointers and Activation Records CS113: Lecture 5 Topics: Pointers Pointers and Activation Records 1 From Last Time: A Useless Function #include void get_age( int age ); int age; get_age( age ); printf( "Your age is: %d\n",

More information

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,

More information

Arrays and Pointers. Arrays. Arrays: Example. Arrays: Definition and Access. Arrays Stored in Memory. Initialization. EECS 2031 Fall 2014.

Arrays and Pointers. Arrays. Arrays: Example. Arrays: Definition and Access. Arrays Stored in Memory. Initialization. EECS 2031 Fall 2014. Arrays Arrays and Pointers l Grouping of data of the same type. l Loops commonly used for manipulation. l Programmers set array sizes explicitly. EECS 2031 Fall 2014 November 11, 2013 1 2 Arrays: Example

More information

SYSC 2006 C Winter 2012

SYSC 2006 C Winter 2012 SYSC 2006 C Winter 2012 Pointers and Arrays Copyright D. Bailey, Systems and Computer Engineering, Carleton University updated Sept. 21, 2011, Oct.18, 2011,Oct. 28, 2011, Feb. 25, 2011 Memory Organization

More information

Arrays and Pointers (part 1)

Arrays and Pointers (part 1) Arrays and Pointers (part 1) CSE 2031 Fall 2012 Arrays Grouping of data of the same type. Loops commonly used for manipulation. Programmers set array sizes explicitly. Arrays: Example Syntax type name[size];

More information

CS 11 C track: lecture 5

CS 11 C track: lecture 5 CS 11 C track: lecture 5 Last week: pointers This week: Pointer arithmetic Arrays and pointers Dynamic memory allocation The stack and the heap Pointers (from last week) Address: location where data stored

More information

Agenda. Peer Instruction Question 1. Peer Instruction Answer 1. Peer Instruction Question 2 6/22/2011

Agenda. Peer Instruction Question 1. Peer Instruction Answer 1. Peer Instruction Question 2 6/22/2011 CS 61C: Great Ideas in Computer Architecture (Machine Structures) Introduction to C (Part II) Instructors: Randy H. Katz David A. Patterson http://inst.eecs.berkeley.edu/~cs61c/sp11 Spring 2011 -- Lecture

More information

CS 61c: Great Ideas in Computer Architecture

CS 61c: Great Ideas in Computer Architecture Arrays, Strings, and Some More Pointers June 24, 2014 Review of Last Lecture C Basics Variables, functioss, control flow, types, structs Only 0 and NULL evaluate to false Pointers hold addresses Address

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 9 Pointer Department of Computer Engineering 1/46 Outline Defining and using Pointers

More information

Sir Syed University of Engineering and Technology. Computer Programming & Problem Solving ( CPPS ) Pointers. Chapter No 7

Sir Syed University of Engineering and Technology. Computer Programming & Problem Solving ( CPPS ) Pointers. Chapter No 7 Computer Programming & Problem Solving ( CPPS ) Chapter No 7 Sir Syed University of Engineering & Technology Computer Engineering Department University Road, Karachi-75300, PAKISTAN Muzammil Ahmad Khan

More information

Kurt Schmidt. October 30, 2018

Kurt Schmidt. October 30, 2018 to Structs Dept. of Computer Science, Drexel University October 30, 2018 Array Objectives to Structs Intended audience: Student who has working knowledge of Python To gain some experience with a statically-typed

More information

Lecture 4: Outline. Arrays. I. Pointers II. III. Pointer arithmetic IV. Strings

Lecture 4: Outline. Arrays. I. Pointers II. III. Pointer arithmetic IV. Strings Lecture 4: Outline I. Pointers A. Accessing data objects using pointers B. Type casting with pointers C. Difference with Java references D. Pointer pitfalls E. Use case II. Arrays A. Representation in

More information

The C Programming Language Part 4. (with material from Dr. Bin Ren, William & Mary Computer Science, and

The C Programming Language Part 4. (with material from Dr. Bin Ren, William & Mary Computer Science, and The C Programming Language Part 4 (with material from Dr. Bin Ren, William & Mary Computer Science, and www.cpp.com) 1 Overview Basic Concepts of Pointers Pointers and Arrays Pointers and Strings Dynamic

More information

C for Java Programmers 1. Last Week. Overview of the differences between C and Java. The C language (keywords, types, functies, etc.

C for Java Programmers 1. Last Week. Overview of the differences between C and Java. The C language (keywords, types, functies, etc. C for Java Programmers 1 Last Week Very short history of C Overview of the differences between C and Java The C language (keywords, types, functies, etc.) Compiling (preprocessor, compiler, linker) C for

More information

C BOOTCAMP DAY 2. CS3600, Northeastern University. Alan Mislove. Slides adapted from Anandha Gopalan s CS132 course at Univ.

C BOOTCAMP DAY 2. CS3600, Northeastern University. Alan Mislove. Slides adapted from Anandha Gopalan s CS132 course at Univ. C BOOTCAMP DAY 2 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Pointers 2 Pointers Pointers are an address in memory Includes variable addresses,

More information

Review of the C Programming Language for Principles of Operating Systems

Review of the C Programming Language for Principles of Operating Systems Review of the C Programming Language for Principles of Operating Systems Prof. James L. Frankel Harvard University Version of 7:26 PM 4-Sep-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights

More information

Agenda. Components of a Computer. Computer Memory Type Name Addr Value. Pointer Type. Pointers. CS 61C: Great Ideas in Computer Architecture

Agenda. Components of a Computer. Computer Memory Type Name Addr Value. Pointer Type. Pointers. CS 61C: Great Ideas in Computer Architecture CS 61C: Great Ideas in Computer Architecture Krste Asanović & Randy Katz http://inst.eecs.berkeley.edu/~cs61c And in Conclusion, 2 Processor Control Datapath Components of a Computer PC Registers Arithmetic

More information

Dynamic memory allocation (malloc)

Dynamic memory allocation (malloc) 1 Plan for today Quick review of previous lecture Array of pointers Command line arguments Dynamic memory allocation (malloc) Structures (Ch 6) Input and Output (Ch 7) 1 Pointers K&R Ch 5 Basics: Declaration

More information

CSCI 171 Chapter Outlines

CSCI 171 Chapter Outlines Contents CSCI 171 Chapter 1 Overview... 2 CSCI 171 Chapter 2 Programming Components... 3 CSCI 171 Chapter 3 (Sections 1 4) Selection Structures... 5 CSCI 171 Chapter 3 (Sections 5 & 6) Iteration Structures

More information

Variation of Pointers

Variation of Pointers Variation of 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

More information

CS 61C: Great Ideas in Computer Architecture. Lecture 3: Pointers. Krste Asanović & Randy Katz

CS 61C: Great Ideas in Computer Architecture. Lecture 3: Pointers. Krste Asanović & Randy Katz CS 61C: Great Ideas in Computer Architecture Lecture 3: Pointers Krste Asanović & Randy Katz http://inst.eecs.berkeley.edu/~cs61c Agenda Pointers in C Arrays in C This is not on the test Pointer arithmetic

More information

First of all, it is a variable, just like other variables you studied

First of all, it is a variable, just like other variables you studied Pointers: Basics What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the address (rather than the value)

More information

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer.

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer. Functions A number of statements grouped into a single logical unit are called a function. The use of function makes programming easier since repeated statements can be grouped into functions. Splitting

More information

Functions. Arash Rafiey. September 26, 2017

Functions. Arash Rafiey. September 26, 2017 September 26, 2017 are the basic building blocks of a C program. are the basic building blocks of a C program. A function can be defined as a set of instructions to perform a specific task. are the basic

More information

Arrays and Pointers (part 1)

Arrays and Pointers (part 1) Arrays and Pointers (part 1) CSE 2031 Fall 2010 17 October 2010 1 Arrays Grouping of data of the same type. Loops commonly used for manipulation. Programmers set array sizes explicitly. 2 1 Arrays: Example

More information

Review of the C Programming Language

Review of the C Programming Language Review of the C Programming Language Prof. James L. Frankel Harvard University Version of 11:55 AM 22-Apr-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights reserved. Reference Manual for the

More information

AN OVERVIEW OF C, PART 3. CSE 130: Introduction to Programming in C Stony Brook University

AN OVERVIEW OF C, PART 3. CSE 130: Introduction to Programming in C Stony Brook University AN OVERVIEW OF C, PART 3 CSE 130: Introduction to Programming in C Stony Brook University FANCIER OUTPUT FORMATTING Recall that you can insert a text field width value into a printf() format specifier:

More information

Chapter 9: Pointers Co C pyr py igh i t gh Pear ea so s n n E ducat ca io i n, n Inc. n c.

Chapter 9: Pointers Co C pyr py igh i t gh Pear ea so s n n E ducat ca io i n, n Inc. n c. Chapter 9: Pointers 9.1 Getting the Address of a Variable C++ Variables [ not in book ] A Variable has all of the following attributes: 1. name 2. type 3. size 4. value 5. storage class static or automatic

More information

CS 137 Part 8. Merge Sort, Quick Sort, Binary Search. November 20th, 2017

CS 137 Part 8. Merge Sort, Quick Sort, Binary Search. November 20th, 2017 CS 137 Part 8 Merge Sort, Quick Sort, Binary Search November 20th, 2017 This Week We re going to see two more complicated sorting algorithms that will be our first introduction to O(n log n) sorting algorithms.

More information

2/28/2018. Overview. The C Programming Language Part 4. Pointers. Pointers. Pointers. Pointers

2/28/2018. Overview. The C Programming Language Part 4. Pointers. Pointers. Pointers. Pointers Overview The C Programming Language Part 4 (with material from Dr. Bin Ren, William & Mary Computer Science, and www.cpp.com) Basic Concepts of and Arrays and Strings Dynamic Memory Allocation 1 2 pointer

More information

Functions in C C Programming and Software Tools

Functions in C C Programming and Software Tools Functions in C C Programming and Software Tools N.C. State Department of Computer Science Functions in C Functions are also called subroutines or procedures One part of a program calls (or invokes the

More information

Pointers. Part VI. 1) Introduction. 2) Declaring Pointer Variables. 3) Using Pointers. 4) Pointer Arithmetic. 5) Pointers and Arrays

Pointers. Part VI. 1) Introduction. 2) Declaring Pointer Variables. 3) Using Pointers. 4) Pointer Arithmetic. 5) Pointers and Arrays EE105: Software Engineering II Part 6 Pointers page 1 of 19 Part VI Pointers 1) Introduction 2) Declaring Pointer Variables 3) Using Pointers 4) Pointer Arithmetic 5) Pointers and Arrays 6) Pointers and

More information

EM108 Software Development for Engineers

EM108 Software Development for Engineers EE108 Section 6 Pointers page 1 of 20 EM108 Software Development for Engineers Section 6 - Pointers 1) Introduction 2) Declaring Pointer Variables 3) Using Pointers 4) Pointer Arithmetic 5) Pointers and

More information

Practice Sheet #07 with Solutions

Practice Sheet #07 with Solutions Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Practice Sheet #07 with Solutions Topic: Pointer in C Date: 23-02-2017 1 Assume the following C variable declaration

More information

C++ Programming Chapter 7 Pointers

C++ Programming Chapter 7 Pointers C++ Programming Chapter 7 Pointers Yih-Peng Chiou Room 617, BL Building (02) 3366-3603 ypchiou@cc.ee.ntu.edu.tw Photonic Modeling and Design Lab. Graduate Institute of Photonics and Optoelectronics & Department

More information

Content. In this chapter, you will learn:

Content. In this chapter, you will learn: ARRAYS & HEAP Content In this chapter, you will learn: To introduce the array data structure To understand the use of arrays To understand how to define an array, initialize an array and refer to individual

More information

C: Pointers, Arrays, and strings. Department of Computer Science College of Engineering Boise State University. August 25, /36

C: Pointers, Arrays, and strings. Department of Computer Science College of Engineering Boise State University. August 25, /36 Department of Computer Science College of Engineering Boise State University August 25, 2017 1/36 Pointers and Arrays A pointer is a variable that stores the address of another variable. Pointers are similar

More information

Functions in C C Programming and Software Tools. N.C. State Department of Computer Science

Functions in C C Programming and Software Tools. N.C. State Department of Computer Science Functions in C C Programming and Software Tools N.C. State Department of Computer Science Functions in C Functions are also called subroutines or procedures One part of a program calls (or invokes the

More information

To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows

To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows Unti 4: C Arrays Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type An array is used to store a collection of data, but it is often more useful

More information

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW IMPORTANT QUESTIONS IN C FOR THE INTERVIEW 1. What is a header file? Header file is a simple text file which contains prototypes of all in-built functions, predefined variables and symbolic constants.

More information

Programming Studio #9 ECE 190

Programming Studio #9 ECE 190 Programming Studio #9 ECE 190 Programming Studio #9 Concepts: Functions review 2D Arrays GDB Announcements EXAM 3 CONFLICT REQUESTS, ON COMPASS, DUE THIS MONDAY 5PM. NO EXTENSIONS, NO EXCEPTIONS. Functions

More information

Output of sample program: Size of a short is 2 Size of a int is 4 Size of a double is 8

Output of sample program: Size of a short is 2 Size of a int is 4 Size of a double is 8 Pointers Variables vs. Pointers: A variable in a program is something with a name and a value that can vary. The way the compiler and linker handles this is that it assigns a specific block of memory within

More information

BBM 101 Introduc/on to Programming I Fall 2014, Lecture 3. Aykut Erdem, Erkut Erdem, Fuat Akal

BBM 101 Introduc/on to Programming I Fall 2014, Lecture 3. Aykut Erdem, Erkut Erdem, Fuat Akal BBM 101 Introduc/on to Programming I Fall 2014, Lecture 3 Aykut Erdem, Erkut Erdem, Fuat Akal 1 Today Introduc/on to Programming Basic Concepts Developing Algorithms Crea

More information

calling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty!

calling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty! Chapter 6 - Functions return type void or a valid data type ( int, double, char, etc) name parameter list void or a list of parameters separated by commas body return keyword required if function returns

More information

Structures. Basics of Structures (6.1) EECS l Now struct point is a valid type. l Defining struct variables: struct point { int x; int y; };

Structures. Basics of Structures (6.1) EECS l Now struct point is a valid type. l Defining struct variables: struct point { int x; int y; }; Structures EECS 2031 25 September 2017 1 Basics of Structures (6.1) struct point { int x; int y; keyword struct introduces a structure declaration. point: structure tag x, y: members The same member names

More information

CS107 Handout 08 Spring 2007 April 9, 2007 The Ins and Outs of C Arrays

CS107 Handout 08 Spring 2007 April 9, 2007 The Ins and Outs of C Arrays CS107 Handout 08 Spring 2007 April 9, 2007 The Ins and Outs of C Arrays C Arrays This handout was written by Nick Parlante and Julie Zelenski. As you recall, a C array is formed by laying out all the elements

More information

Dynamic memory allocation

Dynamic memory allocation Dynamic memory allocation outline Memory allocation functions Array allocation Matrix allocation Examples Memory allocation functions (#include ) malloc() Allocates a specified number of bytes

More information

Q1: /20 Q2: /30 Q3: /24 Q4: /26. Total: /100

Q1: /20 Q2: /30 Q3: /24 Q4: /26. Total: /100 ECE 2035(B) Programming for Hardware/Software Systems Fall 2013 Exam Two October 22 nd 2013 Name: Q1: /20 Q2: /30 Q3: /24 Q4: /26 Total: /100 1/6 For functional call related questions, let s assume the

More information

Systems Programming and Computer Architecture ( )

Systems Programming and Computer Architecture ( ) Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-0061-00) Timothy Roscoe Herbstsemester 2016 1 4: Pointers Computer Architecture and Systems Programming

More information

Fundamentals of Programming Session 20

Fundamentals of Programming Session 20 Fundamentals of Programming Session 20 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2013 These slides have been created using Deitel s slides Sharif University of Technology Outlines

More information

Q1: /8 Q2: /30 Q3: /30 Q4: /32. Total: /100

Q1: /8 Q2: /30 Q3: /30 Q4: /32. Total: /100 ECE 2035(A) Programming for Hardware/Software Systems Fall 2013 Exam Three November 20 th 2013 Name: Q1: /8 Q2: /30 Q3: /30 Q4: /32 Total: /100 1/10 For functional call related questions, let s assume

More information

Subject: Fundamental of Computer Programming 2068

Subject: Fundamental of Computer Programming 2068 Subject: Fundamental of Computer Programming 2068 1 Write an algorithm and flowchart to determine whether a given integer is odd or even and explain it. Algorithm Step 1: Start Step 2: Read a Step 3: Find

More information

COMP26120: Pointers in C (2018/19) Lucas Cordeiro

COMP26120: Pointers in C (2018/19) Lucas Cordeiro COMP26120: Pointers in C (2018/19) Lucas Cordeiro lucas.cordeiro@manchester.ac.uk Organisation Lucas Cordeiro (Senior Lecturer, FM Group) lucas.cordeiro@manchester.ac.uk Office: 2.44 Office hours: 10-11

More information

CENG 447/547 Embedded and Real-Time Systems. Review of C coding and Soft Eng Concepts

CENG 447/547 Embedded and Real-Time Systems. Review of C coding and Soft Eng Concepts CENG 447/547 Embedded and Real-Time Systems Review of C coding and Soft Eng Concepts Recall (C-style coding syntax) ; - Indicate the end of an expression {} - Used to delineate when a sequence of elements

More information

C Pointers. Abdelghani Bellaachia, CSCI 1121 Page: 1

C Pointers. Abdelghani Bellaachia, CSCI 1121 Page: 1 C Pointers 1. Objective... 2 2. Introduction... 2 3. Pointer Variable Declarations and Initialization... 3 4. Reference operator (&) and Dereference operator (*) 6 5. Relation between Arrays and Pointers...

More information

Binary Representation. Decimal Representation. Hexadecimal Representation. Binary to Hexadecimal

Binary Representation. Decimal Representation. Hexadecimal Representation. Binary to Hexadecimal Decimal Representation Binary Representation Can interpret decimal number 4705 as: 4 10 3 + 7 10 2 + 0 10 1 + 5 10 0 The base or radix is 10 Digits 0 9 Place values: 1000 100 10 1 10 3 10 2 10 1 10 0 Write

More information

Decimal Representation

Decimal Representation Decimal Representation Can interpret decimal number 4705 as: 4 10 3 + 7 10 2 + 0 10 1 + 5 10 0 The base or radix is 10 Digits 0 9 Place values: 1000 100 10 1 10 3 10 2 10 1 10 0 Write number as 4705 10

More information

JTSK Programming in C II C-Lab II. Lecture 3 & 4

JTSK Programming in C II C-Lab II. Lecture 3 & 4 JTSK-320112 Programming in C II C-Lab II Lecture 3 & 4 Xu (Owen) He Spring 2018 Slides modified from Dr. Kinga Lipskoch Planned Syllabus The C Preprocessor Bit Operations Pointers and Arrays (Dynamically

More information

CSC 211 Intermediate Programming. Arrays & Pointers

CSC 211 Intermediate Programming. Arrays & Pointers CSC 211 Intermediate Programming Arrays & Pointers 1 Definition An array a consecutive group of memory locations that all have the same name and the same type. To create an array we use a declaration statement.

More information

Introduction to Pointers in C. Address operator. Pointers. Readings: CP:AMA 11, 17.7

Introduction to Pointers in C. Address operator. Pointers. Readings: CP:AMA 11, 17.7 Introduction to Pointers in C Readings: CP:AMA 11, 17.7 CS 136 Fall 2017 06: Pointers 1 Address operator C was designed to give programmers low-level access to memory and expose the underlying memory model.

More information

3/22/2016. Pointer Basics. What is a pointer? C Language III. CMSC 313 Sections 01, 02. pointer = memory address + type

3/22/2016. Pointer Basics. What is a pointer? C Language III. CMSC 313 Sections 01, 02. pointer = memory address + type Pointer Basics What is a pointer? pointer = memory address + type C Language III CMSC 313 Sections 01, 02 A pointer can contain the memory address of any variable type A primitive (int, char, float) An

More information

Floating-point lab deadline moved until Wednesday Today: characters, strings, scanf Characters, strings, scanf questions clicker questions

Floating-point lab deadline moved until Wednesday Today: characters, strings, scanf Characters, strings, scanf questions clicker questions Announcements Thursday Extras: CS Commons on Thursdays @ 4:00 pm but none next week No office hours next week Monday or Tuesday Reflections: when to use if/switch statements for/while statements Floating-point

More information

void setup(){ void loop() { The above setup works, however the function is limited in the fact it can not be reused easily. To make the code more gene

void setup(){ void loop() { The above setup works, however the function is limited in the fact it can not be reused easily. To make the code more gene Passing arrays to functions A big topic for beginners is how to write a function that can be passed an array. A very common way of achieving this is done using pointers. This method can be seen all through

More information

Arrays, Pointers and Memory Management

Arrays, Pointers and Memory Management Arrays, Pointers and Memory Management EECS 2031 Summer 2014 Przemyslaw Pawluk May 20, 2014 Answer to the question from last week strct->field Returns the value of field in the structure pointed to by

More information

Lecture 04 Introduction to pointers

Lecture 04 Introduction to pointers Lecture 04 Introduction to pointers A pointer is an address in the memory. One of the unique advantages of using C is that it provides direct access to a memory location through its address. A variable

More information

10/20/2015. Midterm Topic Review. Pointer Basics. C Language III. CMSC 313 Sections 01, 02. Adapted from Richard Chang, CMSC 313 Spring 2013

10/20/2015. Midterm Topic Review. Pointer Basics. C Language III. CMSC 313 Sections 01, 02. Adapted from Richard Chang, CMSC 313 Spring 2013 Midterm Topic Review Pointer Basics C Language III CMSC 313 Sections 01, 02 1 What is a pointer? Why Pointers? Pointer Caution pointer = memory address + type A pointer can contain the memory address of

More information

CS 61C: Great Ideas in Computer Architecture. Lecture 3: Pointers. Bernhard Boser & Randy Katz

CS 61C: Great Ideas in Computer Architecture. Lecture 3: Pointers. Bernhard Boser & Randy Katz CS 61C: Great Ideas in Computer Architecture Lecture 3: Pointers Bernhard Boser & Randy Katz http://inst.eecs.berkeley.edu/~cs61c Agenda Pointers in C Arrays in C This is not on the test Pointer arithmetic

More information

Chapter 7 C Pointers

Chapter 7 C Pointers Chapter 7 C Pointers Objectives of This Chapter Definition and Operations with Pointers Using Pointers to pass arguments as call by reference call. Using Pointers to deal with arrays and strings. Character

More information

Programming. Pointers, Multi-dimensional Arrays and Memory Management

Programming. Pointers, Multi-dimensional Arrays and Memory Management Programming Pointers, Multi-dimensional Arrays and Memory Management Summary } Computer Memory } Pointers } Declaration, assignment, arithmetic and operators } Casting and printing pointers } Relationship

More information

C Pointers. 6th April 2017 Giulio Picierro

C Pointers. 6th April 2017 Giulio Picierro C Pointers 6th April 07 Giulio Picierro Functions Return type Function name Arguments list Function body int sum(int a, int b) { return a + b; } Return statement (return keyword

More information

Pointers, Pointers, Pointers

Pointers, Pointers, Pointers Pointers, Pointers, Pointers CSE 333 Summer 2018 Instructor: Hal Perkins Teaching Assistants: Renshu Gu William Kim Soumya Vasisht Administrivia v Exercise 2 out today and due Monday morning v Exercise

More information

Lectures 5-6: Introduction to C

Lectures 5-6: Introduction to C Lectures 5-6: Introduction to C Motivation: C is both a high and a low-level language Very useful for systems programming Faster than Java This intro assumes knowledge of Java Focus is on differences Most

More information

advanced data types (2) typedef. today advanced data types (3) enum. mon 23 sep 2002 defining your own types using typedef

advanced data types (2) typedef. today advanced data types (3) enum. mon 23 sep 2002 defining your own types using typedef today advanced data types (1) typedef. mon 23 sep 2002 homework #1 due today homework #2 out today quiz #1 next class 30-45 minutes long one page of notes topics: C advanced data types dynamic memory allocation

More information

What is an algorithm?

What is an algorithm? Announcements CS 142 C++ Pointers Reminder Program 6 due Sunday, Nov. 9 th by 11:55pm 11/3/2014 2 Pointers and the Address Operator Pointer Variables Each variable in a program is stored at a unique address

More information

Department of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #07. Topic: Pointer in C Date:

Department of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #07. Topic: Pointer in C Date: Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Practice Sheet #07 Topic: Pointer in C Date: 23-02-2017 1. Assume the following C variable declaration int *A [10],

More information

High Performance Programming Programming in C part 1

High Performance Programming Programming in C part 1 High Performance Programming Programming in C part 1 Anastasia Kruchinina Uppsala University, Sweden April 18, 2017 HPP 1 / 53 C is designed on a way to provide a full control of the computer. C is the

More information

Lecture 2: C Programm

Lecture 2: C Programm 0 3 E CS 1 Lecture 2: C Programm ing C Programming Procedural thought process No built in object abstractions data separate from methods/functions Low memory overhead compared to Java No overhead of classes

More information

CSCI-1200 Data Structures Fall 2017 Lecture 5 Pointers, Arrays, & Pointer Arithmetic

CSCI-1200 Data Structures Fall 2017 Lecture 5 Pointers, Arrays, & Pointer Arithmetic CSCI-1200 Data Structures Fall 2017 Lecture 5 Pointers, Arrays, & Pointer Arithmetic Review from Letctures 3 & 4 C++ class syntax, designing classes, classes vs. structs; Passing comparison functions to

More information

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University Unit 1 Programming Language and Overview of C 1. State whether the following statements are true or false. a. Every line in a C program should end with a semicolon. b. In C language lowercase letters are

More information

Memory Management. CS449 Fall 2017

Memory Management. CS449 Fall 2017 Memory Management CS449 Fall 2017 Life9mes Life9me: 9me from which a par9cular memory loca9on is allocated un9l it is deallocated Three types of life9mes Automa9c (within a scope) Sta9c (dura9on of program)

More information

CSE 2421: Systems I Low-Level Programming and Computer Organization. Functions. Presentation C. Predefined Functions

CSE 2421: Systems I Low-Level Programming and Computer Organization. Functions. Presentation C. Predefined Functions CSE 2421: Systems I Low-Level Programming and Computer Organization Functions Read/Study: Reek Chapters 7 Gojko Babić 01-22-2018 Predefined Functions C comes with libraries of predefined functions E.g.:

More information

C++ for Java Programmers

C++ for Java Programmers Basics all Finished! Everything we have covered so far: Lecture 5 Operators Variables Arrays Null Terminated Strings Structs Functions 1 2 45 mins of pure fun Introduction Today: Pointers Pointers Even

More information

Computers Programming Course 5. Iulian Năstac

Computers Programming Course 5. Iulian Năstac Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction

More information

COMPUTER APPLICATION

COMPUTER APPLICATION Total No. of Printed Pages 16 HS/XII/A.Sc.Com/CAP/14 2 0 1 4 COMPUTER APPLICATION ( Science / Arts / Commerce ) ( Theory ) Full Marks : 70 Time : 3 hours The figures in the margin indicate full marks for

More information