Ferdig med 8

This commit is contained in:
Trygve 2024-02-26 13:16:42 +01:00
parent 03b9bb9ab2
commit f2eb3a6ddc

View File

@ -2,14 +2,14 @@
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
void crop(int num_strings, char** strings, int characters_cropped); constexpr void crop(int num_strings, char** strings, int characters_cropped);
int main(int argc, char** argv) int main(const int argc, char** argv)
{ {
/* crop the first two letters of each input argument, /* crop the first two letters of each input argument,
* by jumping from index 0 to index 2 * by jumping from index 0 to index 2
*/ */
int jump_to_index = 2; const int jump_to_index = 2;
/* crop all of the strings in argv, except the one with index 0; /* crop all of the strings in argv, except the one with index 0;
* note that argv[0] is always the program's name. * note that argv[0] is always the program's name.
@ -25,7 +25,7 @@ int main(int argc, char** argv)
/* implementation that "crops" a string by incrementing it, so that /* implementation that "crops" a string by incrementing it, so that
* it effectively begins <characters_cropped> characters further ahead. * it effectively begins <characters_cropped> characters further ahead.
*/ */
void crop(int num_strings, char** strings, int characters_cropped) constexpr void crop(int num_strings, char** strings, const int characters_cropped)
{ {
assert(characters_cropped >= 0); assert(characters_cropped >= 0);