473,320 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How is it that the structure pointer is declared with same name of the structure?

The following code,
Expand|Select|Wrap|Line Numbers
  1. struct devinfo{
  2. int a;
  3. int b;
  4. };
  5. struct devinfo *devinfo;
is perfectly legal in C. How is it that the structure pointer is declared with same name of the structure? Does it has a special meaning or significance? Any help will be appreciated.
Jan 21 '11 #1
3 1736
Banfa
9,065 Expert Mod 8TB
structure names and variable names are stored in a different name space within the compiler so it is perfectly valid to use the structure name as the name of a variable (in this case a pointer to a structure of the type named).

It has no special significance.
Jan 21 '11 #2
thanks banfa!
Jan 22 '11 #3
donbock
2,426 Expert 2GB
It has no special significance to the compiler; however it ought to have significance to you the programmer. Using the same name for unrelated things is a good way to get really confused.
Jan 22 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ben Nguyen | last post by:
Im trying to port a hard drive driver that was originally for a different compiler than the one Im using now. The line that doesnt compile with the new compiler is: ActualPartRecord =...
2
by: prakashgkhaire | last post by:
i have two structure where first structure consists val and structure pointer(linklist), 2nd structure consists, val, a varialbe of first structure, pointer of structure. Now i found to pass the...
2
by: Mike | last post by:
Hi, I am new to C and having problems with the following program. Basically I am trying to read some files, loading data structures into memory for latter searching. I am trying to use structres...
5
by: sharat | last post by:
hi all can any body tell how to declare the structure pointer within a class. i have written the following program but gettin error. #include<iostream> using namespace std;
2
Soujiro
by: Soujiro | last post by:
struct sample { string sampleStr; }; int main() { struct sample* structure = (struct sample*) malloc( sizeof( struct sample ) ); structure->sampleStr="Papa"; //...
17
by: RAKHE | last post by:
Hi I am having some warning when i used like this struct creat_table { -------- ---------- }; struct creat_table *table(); int main() { struct creat_table *p;
1
by: =?utf-8?B?5Lq66KiA6JC95pel5piv5aSp5rav77yM5pyb5p6B | last post by:
first, I'm try the POINTER to convesion the pointer type. but failed. class STUDENT(Structure): _fields_ = buffer = c_byte * 1024 student_p = cast(buffer, POINTER(STUDENT)) The parameter...
7
by: mohammadthalif | last post by:
Hello friends, struct datas{ int *a,*b; } *name; can you explain me how can i get the data at location pointed by *a and *b. i tried,
4
by: ashusharma82 | last post by:
plz check following code pMe i an structure pointer,in which char *linewisechar is made. pMe->linewisechar=(pMe->newcchar+STRLEN(pMe->newcchar)-1); here i am assigning...
3
by: Nasif | last post by:
Dear All I am using a C++ DLL which has two function , one returns a void pointer, other returns a pointer to structure .But I doing my project on C#. Which data types in C# should I use to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.