Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C Exercise 87

C Exercise 87

100 Classic C Language Examples 100 Classic C Language Examples

**Problem:** Answer result (structure variable passing).

**Analysis:** None.

Example

// Created by www.runoob.com on 15/11/9.

// Copyright (c) 2015 Runoob Tutorial. All rights reserved.

//

#include

<

stdio.h

struct

student

{

int

x

;

char

c

;

}

a

;

int

main

(

)

{

a

.

x

=

3

;

a

.

c

='

a

';

f

(

a

)

;

printf

(

"

%d,%c

"

,

a

.

x

,

a

.

c

)

;

}

f

(

struct

student

b

)

{

b

.

x

=

20

;

b

.

c

='

y

';

}

The output is:

3,a

100 Classic C Language Examples 100 Classic C Language Examples