1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>


bool count_consecutive_chars(char ch, char** a_pos, int* result) {
}

int main(int argc, char* argv[]) {
    int result;
    char* input = "aaabbcccc"; // address of the first character of this string (on the data segment)
    char* pos = input;         // address of the character to look at next
    bool found_any = count_consecutive_chars('a', &pos, &result);
    
    // Q1:  What is the type of &pos?
    // A1:  char**  --- because pos was declared as char*, and putting & before expression adds a * to its type.
    //
    // Q2:  What is the type of &result?
    // A2:  int* -- because result was declared as int and ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
    return EXIT_SUCCESS;
}
/* vim: set tabstop=4 shiftwidth=4 fileencoding=utf-8 noexpandtab: */

© Copyright 2022 Alexander J. Quinn         This content is protected and may not be shared, uploaded, or distributed.