Click here to Skip to main content
16,004,887 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: c++ query Pin
TheGreatAndPowerfulOz14-Mar-05 4:10
TheGreatAndPowerfulOz14-Mar-05 4:10 
Generaldelphi convert Pin
mohsen nourian13-Mar-05 21:38
mohsen nourian13-Mar-05 21:38 
QuestionHow "add text to a graphics such us rectangle " Pin
Anonymous13-Mar-05 21:13
Anonymous13-Mar-05 21:13 
General.net setup project Pin
ThinkingPrometheus13-Mar-05 21:03
ThinkingPrometheus13-Mar-05 21:03 
GeneralLoki library Pin
Bob Stanneveld13-Mar-05 20:55
Bob Stanneveld13-Mar-05 20:55 
GeneralDatabase connection without DSN Pin
Renjith Ramachandran13-Mar-05 18:31
Renjith Ramachandran13-Mar-05 18:31 
GeneralRe: Database connection without DSN Pin
David Crow14-Mar-05 3:12
David Crow14-Mar-05 3:12 
Generalthe use of register variable in c and cpp program Pin
phijophlip13-Mar-05 17:09
phijophlip13-Mar-05 17:09 
Hello Friends,

Please obeserve the cpp program given below

#include <iostream.h>

int main(void)
{
register int i = 10;

cout <<"the address of i" << &i << endl;

cout <<"the value of i is " << i << endl;

return 0;

}

The output of the program is given below

the address of is 0x0012FF7C
the value of i is 10

The same program is written in C and the program is given below

#include <stdio.h>

int main(void)
{
register int i = 3 ;

printf ("the address of i %u", &i);
printf ("the value of i %d" , i);

return 0;
}

The program show an error which is given below

compiling...
register_c.c
D:\c++\registe_test\register_c.c(7) : error C2103: '&' on register variable
Error executing cl.exe.

register_c.obj - 1 error(s), 0 warning(s)

My question is what is the difference in the use of register variable is c and cpp program.I am able to get the address of register variable in cpp using the "&i". The same technique is not allowed in c program .

Can anyone tell what is the reason this is happening.

Hoping for a reply.

Best Regards,
Phijo Philip.


Smile | :)
GeneralRe: the use of register variable in c and cpp program Pin
PJ Arends13-Mar-05 18:56
professionalPJ Arends13-Mar-05 18:56 
GeneralRe: the use of register variable in c and cpp program Pin
normanS13-Mar-05 22:44
normanS13-Mar-05 22:44 
QuestionHow do I communicate with parallel port Pin
13-Mar-05 16:15
suss13-Mar-05 16:15 
AnswerRe: How do I communicate with parallel port Pin
Nickmatic13-Mar-05 16:35
Nickmatic13-Mar-05 16:35 
GeneralRe: How do I communicate with parallel port Pin
Member 176156313-Mar-05 16:46
Member 176156313-Mar-05 16:46 
GeneralRe: How do I communicate with parallel port Pin
Nickmatic13-Mar-05 17:49
Nickmatic13-Mar-05 17:49 
AnswerRe: How do I communicate with parallel port Pin
Indivara13-Mar-05 16:53
professionalIndivara13-Mar-05 16:53 
AnswerRe: How do I communicate with parallel port Pin
namaskaaram13-Mar-05 17:02
namaskaaram13-Mar-05 17:02 
AnswerRe: How do I communicate with parallel port Pin
MADCOWIE4-Apr-05 17:26
MADCOWIE4-Apr-05 17:26 
GeneralSome stupid question.. Pin
Romashki13-Mar-05 12:03
Romashki13-Mar-05 12:03 
GeneralRe: Some stupid question.. Pin
JohnCz13-Mar-05 13:22
JohnCz13-Mar-05 13:22 
GeneralRe: Some stupid question.. Pin
Romashki15-Mar-05 7:41
Romashki15-Mar-05 7:41 
GeneralRe: Some stupid question.. Pin
JohnCz18-Mar-05 5:44
JohnCz18-Mar-05 5:44 
GeneralRe: Some stupid question.. Pin
Romashki18-Mar-05 9:45
Romashki18-Mar-05 9:45 
GeneralRect Value AGAIN!!!!!!! Pin
13-Mar-05 11:26
suss13-Mar-05 11:26 
GeneralRe: Rect Value AGAIN!!!!!!! Pin
Ravi Bhavnani13-Mar-05 11:35
professionalRavi Bhavnani13-Mar-05 11:35 
GeneralRe: Rect Value AGAIN!!!!!!! Pin
gdocherty13-Mar-05 13:28
gdocherty13-Mar-05 13:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.