Register Keyword
Thread Tags
Adobe Illustrator Adobe InDesign Adobe Photoshop Android Development Android Programming Android Studio Automation Testing bitmap file Brochure design C / C++ Programming Career Option Career Options College Lounge css CSS/HTML sandbox digital marketing Digital Marketing / SEO Fireworks Graphic Design Graphic designing Graphics Design Graphics Designing HTML? Illustrator Internship Training Liquify Tools logo Design logo designing Mobile UI Development Photoshop QA react-native Responsive Design SEO Testing Typography UI UI/UX Development UI Design UI Designing UI development User Interface UX Design Web Designing Website Design-
Register for free!
Registration at Smart Mentors is completely free and takes only a few seconds. By registering you’ll gain:
- Full Posting Privileges.
- Access to Private Messaging.
- Optional Email Notification.
- Ability to Fully Participate.
Register Now, or check out the Site Tour and find out everything Smart Mentors has to offer.
Tagged: C / C++ Programming
This thread contains 1 reply, has 2 voices, and was last updated by Nitesh User Do not delete 6 years, 1 month ago.
-
Author Replies
-
-
February 18, 2019 at 10:24 am #53731
1) Register keyword implies that of conceivable to store the variable in the register than store it in the register.
2) Variables are generally stored in stacks and are passed back and forth to a processor at whatever point required.
3) Also, register keyword when utilized decreased code size which is something critical in an embedded system.
Registers are quicker than memory to get to, so the variables which are most every now and again utilized in a C program can be placed in registers utilizing register keyword. The keyword register clues to the compiler that a given variable can be placed in a register. It’s compiler’s decision to place it in a register or not.
1) If you use an operator with a register variable then the compiler may give an error or cautioning : –
int main()
{
register int i = 10;
int *a = &i;
printf(“%d”, *a);
getchar();
return 0;
}2) Register keyword can be utilized with Pointer Variables: –
int main()
{
int i = 10;
register int *a = &i;
printf(“%d”, *a);
getchar();
return 0;
}3) The register is a storage class, and C doesn’t permit different storage class specifiers for a variable: –
int main()
{
int i = 10;
register static int *a = &i;
printf(“%d”, *a);
getchar();
return 0;
}There is no restriction on a number of register variables in a C program, yet the fact of the matter is compiler may put a few variables in the register and some not.
Regards,
Nitesh Bavishiya -
AuthorPosts
You must be logged in to reply to this thread.Please login or register. Registration is 100% free.