Online Courses
Free Tutorials  Go to Your University  Placement Preparation 
Goeduhub's Online Courses @ Udemy in Just INR 570/-
Online Training - Youtube Live Class Link
0 like 0 dislike
77 views
in Tutorial & Interview questions by Goeduhub's Expert (8.3k points)

_Alignof

Version ≥ C11

Goeduhub's Top Online Courses @Udemy

For Indian Students- INR 570/- || For International Students- $12.99/-

S.No.

Course Name

 Coupon

1.

Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence

Apply Coupon

2.

Natural Language Processing-NLP with Deep Learning in Python Apply Coupon

3.

Computer Vision OpenCV Python | YOLO| Deep Learning in Colab Apply Coupon
    More Courses

1 Answer

0 like 0 dislike
by Goeduhub's Expert (8.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

3.3k questions

7.1k answers

393 comments

4.5k users

Related questions

0 like 0 dislike
1 answer 71 views
0 like 0 dislike
0 answers 76 views
0 like 0 dislike
1 answer 120 views
0 like 0 dislike
1 answer 83 views
0 like 0 dislike
1 answer 64 views

 Goeduhub:

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