FIFA-2022 Career Guide Free Tutorials Go to Your University Placement Preparation 
0 like 0 dislike
267 views
in Tutorial & Interview questions by Goeduhub's Expert (9.3k points)

_Alignof

Version ≥ C11

1 Answer

0 like 0 dislike
by Goeduhub's Expert (9.3k points)
 
Best answer

Queries the alignment requirement for the specified type. The alignment requirement is a positive integral power of 2 representing the number of bytes between which two objects of the type may be allocated. In C, the alignment requirement is measured in size_t.

The type name may not be an incomplete type nor a function type. If an array is used as the type, the type of the array element is used.

This operator is often accessed through the convenience macro alignof from <stdalign.h>.

int main(void) 

{    

printf("Alignment of char = %zu\n", alignof(char));    

printf("Alignment of max_align_t = %zu\n", alignof(max_align_t));    

printf("alignof(float[10]) = %zu\n", alignof(float[10]));    

printf("alignof(struct{char c; int n;}) = %zu\n", alignof(struct {char c; int n;}));    

}

Possible Output:

Alignment of char = 1 

Alignment of max_align_t = 16 

alignof(float[10]) = 4 

alignof(struct{char c; int n;}) = 4

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

Related questions

0 like 0 dislike
1 answer 265 views
0 like 0 dislike
0 answers 258 views
0 like 0 dislike
1 answer 602 views
0 like 0 dislike
1 answer 335 views
0 like 0 dislike
1 answer 234 views

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 

 

Free Online Directory

...