Add CMakeLists.txt and answer for problem 1
This commit is contained in:
parent
4c01a13684
commit
b345ff63cc
14
CMakeLists.txt
Normal file
14
CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(practice_exam_2 C)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
add_executable(${PROJECT_NAME})
|
||||
|
||||
file(GLOB proj_sources LIST_DIRECTORIES false CONFIGURE_DEPENDS src/*.c)
|
||||
set(proj_include "include")
|
||||
|
||||
# Add sources to target
|
||||
target_sources(${PROJECT_NAME} PRIVATE "${proj_sources}")
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE "${proj_include}")
|
||||
|
||||
7
include/p1.h
Normal file
7
include/p1.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef P1_H
|
||||
#define P1_H
|
||||
|
||||
int count_alphanumeric(const char* str);
|
||||
|
||||
#endif
|
||||
|
||||
14
src/main.c
Normal file
14
src/main.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "p1.h"
|
||||
|
||||
int main(void) {
|
||||
// Problem 1
|
||||
int num_alphanum = count_alphanumeric("Hello World!!");
|
||||
printf("Number of alphanumeric characters in \"Hello World!!\": %d\n", num_alphanum);
|
||||
|
||||
// Problem 2
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user