Overview
This is a shared-file task. All 8 members will edit the same file.
This is intentional — you will experience and resolve merge conflicts firsthand.
Conflict resolution is a core GitHub skill. This task teaches it by forcing it.
The File
dsa/pointer-roster.cpp
This file already exists in the repo with starter code. Do not create a new one. You will get the sample code in the file at locatoin dsa/examples/pointer-roster.cpp
Your Task — 3 Steps
Step 1 — Add your name to the pointer array
Find the roster[] array in the file. Add a pointer to your name at the next available index.
const char* roster[] = {
"ik-awais", // index 0 — already there, do not remove
"your-github-name", // add yours here at the next index
};
This is a const char* array. Each element is a pointer to a string literal stored in memory.
Step 2 — Write your pointer function
Write a function named count_yourname that takes a const char* pointer and returns
the number of characters in the string — without using strlen.
You must walk the string using pointer arithmetic only.
int count_yourname(const char* name) {
int len = 0;
while (*name != '\0') {
len++;
name++; // move the pointer forward one character
}
return len;
}
Replace yourname with your actual GitHub username (no hyphens, all lowercase).
Example: count_coderretro, count_arshkhattak, count_syedaeasha
Step 3 — Call your function inside main()
Inside main(), below the existing call, add one line that calls your function and prints the result.
cout << "Length of 'your-name': " << count_yourname(roster[your_index]) << endl;
Expected Conflicts
When you open your Pull Request, there is a high chance it will conflict with a teammate's PR.
When a conflict happens:
# Sync your branch with the latest main before pushing
git checkout main
git pull origin main
git checkout your-branch
git merge main
# Open the conflicting file — you will see markers like this:
# <<<<<<< HEAD
# "ik-awais",
# =======
# "coder-Retro",
# >>>>>>> your-branch
# Keep BOTH entries. Remove the markers. Save the file.
# Then:
git add .
git commit -m "chore: resolve merge conflict in pointer-roster.cpp"
git push origin your-branch
Rule: never delete a teammate's entry when resolving a conflict. Keep all names.
Acceptance Criteria
Suggested Commit Message
feat: add pointer entry and count function for [your-name]
Starter File
The code can be found at dsa/examples/pointer-roster.cpp
/*
* File: pointer-roster.cpp
* Task: DSA — Pointers
* Repo: github.com/ik-awais/Octagon
* Date: 2026
*
* Description:
* A shared team file. Each member adds their name to the roster
* pointer array and writes a pointer arithmetic function.
* This file is intentionally shared to practice conflict resolution.
*/
#include <iostream>
using namespace std;
// ─── STEP 1 ────────────────────────────────────────────────────────────
// Add a pointer to your name in this array at the next available index.
// Do not remove any existing entry.
const char* roster[] = {
"ik-awais", // index 0
// members: add your entry below this line
};
// ─── STEP 2 ────────────────────────────────────────────────────────────
// Write your count function below using pointer arithmetic only.
// No strlen allowed.
int count_ikawais(const char* name) {
int len = 0;
while (*name != '\0') {
len++;
name++;
}
return len;
}
// ─── YOUR FUNCTION GOES HERE ────────────────────────────────────────────
// ─── STEP 3 ────────────────────────────────────────────────────────────
int main() {
// Print all roster members via pointer traversal
int size = sizeof(roster) / sizeof(roster[0]);
const char** ptr = roster;
for (int i = 0; i < size; i++) {
cout << "Member " << (i + 1) << ": " << *ptr << endl;
ptr++;
}
cout << "---" << endl;
// Function calls — example already here:
cout << "Length of 'ik-awais': " << count_ikawais(roster[0]) << endl;
// ADD YOUR FUNCTION CALL BELOW THIS LINE
return 0;
}
Overview
This is a shared-file task. All 8 members will edit the same file.
This is intentional — you will experience and resolve merge conflicts firsthand.
Conflict resolution is a core GitHub skill. This task teaches it by forcing it.
The File
dsa/pointer-roster.cppThis file already exists in the repo with starter code. Do not create a new one. You will get the sample code in the file at locatoin
dsa/examples/pointer-roster.cppYour Task — 3 Steps
Step 1 — Add your name to the pointer array
Find the
roster[]array in the file. Add a pointer to your name at the next available index.Step 2 — Write your pointer function
Write a function named
count_yournamethat takes aconst char*pointer and returnsthe number of characters in the string — without using
strlen.You must walk the string using pointer arithmetic only.
Replace
yournamewith your actual GitHub username (no hyphens, all lowercase).Example:
count_coderretro,count_arshkhattak,count_syedaeashaStep 3 — Call your function inside main()
Inside
main(), below the existing call, add one line that calls your function and prints the result.cout << "Length of 'your-name': " << count_yourname(roster[your_index]) << endl;Expected Conflicts
When you open your Pull Request, there is a high chance it will conflict with a teammate's PR.
When a conflict happens:
Acceptance Criteria
roster[]at the correct next indexcount_yourname()function is written using pointer arithmetic only — nostrlenmain()and prints outputg++ pointer-roster.cpp -o rostermainwithik-awaisas reviewerSuggested Commit Message
feat: add pointer entry and count function for [your-name]Starter File
The code can be found at
dsa/examples/pointer-roster.cpp