Comparison of Integer and Pointer (that's supposed to be an Integer). Where did I go wrong?

Nov 19, 2022
Reaction score
Basically I tried to create a program that is shifting the components of an array.
Now I get a warning for the i < textlaenge part.
I think the textlaenge (textlength) part became a pointer somehow but I thought I'd have defined it as an Integer.
Do you have any idea? It would help me a lot!
Thanks in advance!

#include <stdio.h>

int textlaenge(char text[]) {
int laenge = 0;
while (text[laenge] != '\0') //mit '\0' werden C-Strings abgeschlossen
return laenge;

void shiftString(char text[], int shift) {
for(int j = 0; j < shift; j++){
for(int i = 0; i < textlaenge; i++){
if(i < textlaenge - 1)
text = text[i+1];
text = text[0];

int main(void) {
char str[25] = "Das ist der Originaltext"; // Originaltext

printf("Original: %s\n", str);
shiftString(str, 5);
printf("Verschoben um %d stellen: %s\n", 5, str);
shiftString(str, 19);
printf("Nochmal um um %d stellen verschoben: %s\n", 19, str);


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question