Contents

  1. .
  2. ./index.html
  3. ./sizeof_example.c

. 1/3

[
top][prev][next]


./index.html 2/3

[
top][prev][next]
<html>
<head><title>Examples for /home/faculty/sprenkle/public_html/cs330/examples/05-make</title>
<link rel="stylesheet" type="text/css" href="http://www.cs.wlu.edu/~sprenkle/cs330/assignments/assign.css" />
</head>
<body>
<h1>Examples for /home/faculty/sprenkle/public_html/cs330/examples/05-make</h1>
<ul>
<li><a href=".//code.html">All IN ONE FILE (pretty syntax)</a>
<li><a href=".//sizeof_example.c">sizeof_example.c</a></li>
</ul>
</body>

./sizeof_example.c 3/3

[
top][prev][next]

/*
 * Example using sizeof.
 * Demonstrates importance of knowing what you're passing to a function.
 */

#include<stdio.h>

int function(int x[]) {
    return (int) sizeof(x);   
}

int main() {
    int a[20];
    printf("sizeof(int) = %d\n sizeof(a) = %d\n", sizeof(int), sizeof(a));
    printf("sizeof(&a) = %d\n", sizeof(&a));

    printf("function returns %d\n", function(a));
}

Generated by GNU Enscript 1.6.6.