SlideShare a Scribd company logo
1 of 1
Download to read offline
I
’ve given dummy names for some #defines from a few
C header files from GCC (Linux) implementation. By
looking at the definition of the macro, guess the name
of the macro and which header file it is from.
1) 	 #define MACRO1 	 (-INT_MAX – 1)
	 #define MACRO2 	 (INT_MAX * 2U + 1)
2)	 #define MACRO3(c) 	 ((unsigned)(c)<=0177)
	 #define MACRO4(c) 	 ((c)&0177)
3) 	 #define MACRO5() 	 getc(stdin)
	 #define MACRO6(x) 	 putc(x, stdout)
4) 	 #define MACRO7 	 ((void *)0)
	 #define MACRO8(TYPE, MEMBER) 	 ((size_t)
&((TYPE *)0)->MEMBER)
Now, check your answers.
1.	 From <limits.h>: MACRO1 is INT_MIN and MACRO2
is UINT_MAX. You can cross-check if the values are
correct with an example: If size of int is 2, range is
-32768 to 32767 and 65535 is equal to ((32767 * 2) + 1).
2.	 An aside: Some implementations define INT_MAX
as (((unsigned int)~0)>>1). ~0 is -1 (all 1s in binary is
decimal value -1 in signed integer). When -1 is casted
to unsigned int, it is UINT_MAX. If you right-shift it by
one, it is INT_MAX in int.
3.	 From <ctype.h>: MACRO3 is isascii and MACRO4 is
toascii. In the octal value 0177, 1 is 001 and 7 is 111 in
binary. So, 0177 fills 1s in a byte except for the sign-bit,
i.e., it stands for binary value 01111111 (which is 127
in decimal and 0xFF in hexa). ASCII values are from 0
to 127. Given the argument ‘c’, the second macro takes
only the lowest byte (by ‘and’ing it with all ones for 7
bits); so it implements toascii.
4.	 From <stdio.h>: MACRO5 is getchar and MACRO6 is
putchar. getchar and putchar are short-cuts for calling
the getc and putc with stdin and stdout respectively
(most C programmers think that getchar and putchar
are separate functions)!
5.	 From <stddef.h>: MACRO7 is NULL and MACRO8 is
offsetof.
6.	 In C, NULL is used universally for initialising all
pointer types, for example, “int *p = NULL”. We
define NULL as 0, but 0 is an integer value—it is
better to treat it as a pointer value. So, we convert it
explicitly to the universal pointer type (void *), and
hence this macro definition.
		 The offset of a macro is a little difficult to
understand, so, I’ll explain in detail. This macro is
used for finding the offset of a struct member from
the base address of the struct variable (in other
words, the number of bytes from the base address of
the struct variable). For example, consider a “struct
student” that has members like “name”, “DOB” (date-
of-birth), “rollno”, etc.:
struct student {
char name[20];
struct {
short day;
short month;
short year;
} DOB;
int rollno;
};
		 Now, how many bytes is “rollno” from the base
address of the struct? To find that (portably), we should
use “offsetof ” as in:
size_t position = offsetof(struct student, rollno);
		 To understand how this implementation works,
let’s look at the expansion first:
size_t position = ((size_t) &((student *)0)->rollno)
		 We’ll start from the innermost expression:
“((student *)0)”. This is to get an expression of type
“(student *)” for the base address 0. Now, “((student
*)0)->rollno)” refers to the member “rollno”. After that,
using “&” (addressof) takes the address of the “rollno”
member in “student struct”. Since the base address
is 0, we’re getting the number of bytes from which
“rollno” is from 0 (which is also the base address of
the struct variable). Since the type of the resulting
value is expected as “size_t”, we cast the expression as
“(size_t)”.
		 Now a bonus: Here is an alternative
implementation of “offsetof ”, based on same logic:
#define offsetof(type, mem) ((size_t) ((char *)&((type *)0)->mem - (char
*)(type *)0))
Okay, that’s all for this month: Go ahead and explore more
such macros in C header files!
Test Your C skills
In this column, we’ll look at how some macros are implemented in C header files in Linux.
About the author:
S G Ganesh is a research engineer in Siemens (Corporate
Technology). His latest book is “60 Tips on Object Oriented
Programming”, published by Tata McGraw-Hill. You can reach
him at sgganesh@gmail.com.
_____________________________________________ Guest Column  |  The Joy of Programming
www.LinuxForU.com  |  LINUX For You  |  JANUARY 2010  |  13
S.G. Ganesh

More Related Content

What's hot (20)

Lecture 17 - Strings
Lecture 17 - StringsLecture 17 - Strings
Lecture 17 - Strings
 
Lecture 18 - Pointers
Lecture 18 - PointersLecture 18 - Pointers
Lecture 18 - Pointers
 
Arrry structure Stacks in data structure
Arrry structure Stacks  in data structureArrry structure Stacks  in data structure
Arrry structure Stacks in data structure
 
Multidimensional arrays in C++
Multidimensional arrays in C++Multidimensional arrays in C++
Multidimensional arrays in C++
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
Resource wrappers in C++
Resource wrappers in C++Resource wrappers in C++
Resource wrappers in C++
 
C++ references
C++ referencesC++ references
C++ references
 
Learning C++ - Pointers in c++ 2
Learning C++ - Pointers in c++ 2Learning C++ - Pointers in c++ 2
Learning C++ - Pointers in c++ 2
 
C tech questions
C tech questionsC tech questions
C tech questions
 
C Structure and Union in C
C Structure and Union in CC Structure and Union in C
C Structure and Union in C
 
Lab 6
Lab 6Lab 6
Lab 6
 
Lab 9 sem ii_12_13
Lab 9 sem ii_12_13Lab 9 sem ii_12_13
Lab 9 sem ii_12_13
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13
 
Arrays in C++
Arrays in C++Arrays in C++
Arrays in C++
 
Pointers
PointersPointers
Pointers
 
OO-like C Programming: Struct Inheritance and Virtual Function
OO-like C Programming: Struct Inheritance and Virtual FunctionOO-like C Programming: Struct Inheritance and Virtual Function
OO-like C Programming: Struct Inheritance and Virtual Function
 
F sharp _vs2010_beta2
F sharp _vs2010_beta2F sharp _vs2010_beta2
F sharp _vs2010_beta2
 
Bind me if you can
Bind me if you canBind me if you can
Bind me if you can
 
Lecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C ProgrammingLecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C Programming
 

Similar to C language sample test

Lecture 15_Strings and Dynamic Memory Allocation.pptx
Lecture 15_Strings and  Dynamic Memory Allocation.pptxLecture 15_Strings and  Dynamic Memory Allocation.pptx
Lecture 15_Strings and Dynamic Memory Allocation.pptxJawadTanvir
 
C,c++ interview q&a
C,c++ interview q&aC,c++ interview q&a
C,c++ interview q&aKumaran K
 
Visual Programing basic lectures 7.pptx
Visual Programing basic lectures  7.pptxVisual Programing basic lectures  7.pptx
Visual Programing basic lectures 7.pptxMrhaider4
 
C++ Course - Lesson 3
C++ Course - Lesson 3C++ Course - Lesson 3
C++ Course - Lesson 3Mohamed Ahmed
 
Dynamic memory allocation in c++
Dynamic memory allocation in c++Dynamic memory allocation in c++
Dynamic memory allocation in c++Tech_MX
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework HelpC++ Homework Help
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...AntareepMajumder
 
Task Perform addition subtraction division and multiplic.pdf
Task Perform addition subtraction division and multiplic.pdfTask Perform addition subtraction division and multiplic.pdf
Task Perform addition subtraction division and multiplic.pdfacsmadurai
 
1. DSA - Introduction.pptx
1. DSA - Introduction.pptx1. DSA - Introduction.pptx
1. DSA - Introduction.pptxhara69
 

Similar to C language sample test (20)

Linked list
Linked listLinked list
Linked list
 
Lecture 15_Strings and Dynamic Memory Allocation.pptx
Lecture 15_Strings and  Dynamic Memory Allocation.pptxLecture 15_Strings and  Dynamic Memory Allocation.pptx
Lecture 15_Strings and Dynamic Memory Allocation.pptx
 
03 structures
03 structures03 structures
03 structures
 
Copy on write
Copy on writeCopy on write
Copy on write
 
C,c++ interview q&a
C,c++ interview q&aC,c++ interview q&a
C,c++ interview q&a
 
Lecture 2 java.pdf
Lecture 2 java.pdfLecture 2 java.pdf
Lecture 2 java.pdf
 
Visual Programing basic lectures 7.pptx
Visual Programing basic lectures  7.pptxVisual Programing basic lectures  7.pptx
Visual Programing basic lectures 7.pptx
 
Bc0037
Bc0037Bc0037
Bc0037
 
C++ Course - Lesson 3
C++ Course - Lesson 3C++ Course - Lesson 3
C++ Course - Lesson 3
 
Op ps
Op psOp ps
Op ps
 
Dynamic memory allocation in c++
Dynamic memory allocation in c++Dynamic memory allocation in c++
Dynamic memory allocation in c++
 
C++_notes.pdf
C++_notes.pdfC++_notes.pdf
C++_notes.pdf
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
 
Csharp4 basics
Csharp4 basicsCsharp4 basics
Csharp4 basics
 
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework Help
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_08-08-2022_C_...
 
Task Perform addition subtraction division and multiplic.pdf
Task Perform addition subtraction division and multiplic.pdfTask Perform addition subtraction division and multiplic.pdf
Task Perform addition subtraction division and multiplic.pdf
 
1. DSA - Introduction.pptx
1. DSA - Introduction.pptx1. DSA - Introduction.pptx
1. DSA - Introduction.pptx
 
Unit 3
Unit 3 Unit 3
Unit 3
 

Recently uploaded

Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 

Recently uploaded (20)

Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 

C language sample test

  • 1. I ’ve given dummy names for some #defines from a few C header files from GCC (Linux) implementation. By looking at the definition of the macro, guess the name of the macro and which header file it is from. 1) #define MACRO1 (-INT_MAX – 1) #define MACRO2 (INT_MAX * 2U + 1) 2) #define MACRO3(c) ((unsigned)(c)<=0177) #define MACRO4(c) ((c)&0177) 3) #define MACRO5() getc(stdin) #define MACRO6(x) putc(x, stdout) 4) #define MACRO7 ((void *)0) #define MACRO8(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) Now, check your answers. 1. From <limits.h>: MACRO1 is INT_MIN and MACRO2 is UINT_MAX. You can cross-check if the values are correct with an example: If size of int is 2, range is -32768 to 32767 and 65535 is equal to ((32767 * 2) + 1). 2. An aside: Some implementations define INT_MAX as (((unsigned int)~0)>>1). ~0 is -1 (all 1s in binary is decimal value -1 in signed integer). When -1 is casted to unsigned int, it is UINT_MAX. If you right-shift it by one, it is INT_MAX in int. 3. From <ctype.h>: MACRO3 is isascii and MACRO4 is toascii. In the octal value 0177, 1 is 001 and 7 is 111 in binary. So, 0177 fills 1s in a byte except for the sign-bit, i.e., it stands for binary value 01111111 (which is 127 in decimal and 0xFF in hexa). ASCII values are from 0 to 127. Given the argument ‘c’, the second macro takes only the lowest byte (by ‘and’ing it with all ones for 7 bits); so it implements toascii. 4. From <stdio.h>: MACRO5 is getchar and MACRO6 is putchar. getchar and putchar are short-cuts for calling the getc and putc with stdin and stdout respectively (most C programmers think that getchar and putchar are separate functions)! 5. From <stddef.h>: MACRO7 is NULL and MACRO8 is offsetof. 6. In C, NULL is used universally for initialising all pointer types, for example, “int *p = NULL”. We define NULL as 0, but 0 is an integer value—it is better to treat it as a pointer value. So, we convert it explicitly to the universal pointer type (void *), and hence this macro definition. The offset of a macro is a little difficult to understand, so, I’ll explain in detail. This macro is used for finding the offset of a struct member from the base address of the struct variable (in other words, the number of bytes from the base address of the struct variable). For example, consider a “struct student” that has members like “name”, “DOB” (date- of-birth), “rollno”, etc.: struct student { char name[20]; struct { short day; short month; short year; } DOB; int rollno; }; Now, how many bytes is “rollno” from the base address of the struct? To find that (portably), we should use “offsetof ” as in: size_t position = offsetof(struct student, rollno); To understand how this implementation works, let’s look at the expansion first: size_t position = ((size_t) &((student *)0)->rollno) We’ll start from the innermost expression: “((student *)0)”. This is to get an expression of type “(student *)” for the base address 0. Now, “((student *)0)->rollno)” refers to the member “rollno”. After that, using “&” (addressof) takes the address of the “rollno” member in “student struct”. Since the base address is 0, we’re getting the number of bytes from which “rollno” is from 0 (which is also the base address of the struct variable). Since the type of the resulting value is expected as “size_t”, we cast the expression as “(size_t)”. Now a bonus: Here is an alternative implementation of “offsetof ”, based on same logic: #define offsetof(type, mem) ((size_t) ((char *)&((type *)0)->mem - (char *)(type *)0)) Okay, that’s all for this month: Go ahead and explore more such macros in C header files! Test Your C skills In this column, we’ll look at how some macros are implemented in C header files in Linux. About the author: S G Ganesh is a research engineer in Siemens (Corporate Technology). His latest book is “60 Tips on Object Oriented Programming”, published by Tata McGraw-Hill. You can reach him at sgganesh@gmail.com. _____________________________________________ Guest Column  |  The Joy of Programming www.LinuxForU.com  |  LINUX For You  |  JANUARY 2010  |  13 S.G. Ganesh