
Write a function that exchanges the two char * pointers held at two addresses, without touching a single character of either string.
a = "alpha", b = "beta", swap_str(&a, &b)Expected result
a=[beta] b=[alpha]For your own tracking. Tests grade your code.
a = "", b = "cargo build --release", swap_str(&a, &b)Expected result
a=[cargo build --release] b=[]a points at one[] = "alpha", b points at two[] = "beta", swap_str(&a, &b)Expected result
one=[alpha] two=[beta] a=[beta] b=[alpha]a = "git bisect", swap_str(&a, &a)Expected result
a=[git bisect]b = "make -j8", swap_str(NULL, &b)Expected result
b=[make -j8]Expected files
swap_str.cAllowed functions
None. Write every helper yourself.
Allowed headers

Write a function that exchanges the two char * pointers held at two addresses, without touching a single character of either string.
a = "alpha", b = "beta", swap_str(&a, &b)Expected result
a=[beta] b=[alpha]For your own tracking. Tests grade your code.
a = "", b = "cargo build --release", swap_str(&a, &b)Expected result
a=[cargo build --release] b=[]a points at one[] = "alpha", b points at two[] = "beta", swap_str(&a, &b)Expected result
one=[alpha] two=[beta] a=[beta] b=[alpha]a = "git bisect", swap_str(&a, &a)Expected result
a=[git bisect]b = "make -j8", swap_str(NULL, &b)Expected result
b=[make -j8]Expected files
swap_str.cAllowed functions
None. Write every helper yourself.
Allowed headers

Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.
v0.40: Create exercises. Challenge the community.
Meet Studio →