#Meta-Wlp: #Macro: TITLE wlp: Learn C (IV) p. 6 #Eval: $TITLE$ #Macro: PAGE bb4-6

Yes, C arguments are call-by-value, always!

The following variation does not compile. Why?
#include<stdio.h>

int make_me_upper( char * s, int from, int count ) {
   int delta ;
   delta = 'a' - 'A' ;
   while (count--) {
      (s+from) = (s+from) - delta  ;
      from++ ;
   }
}

int main(){
  char * t ;
  t = "Why must you shout so loud" ;
  make_me_upper(t, 13, 5 ) ;
  printf ("%s?\n",t) ;
}
#Shuffle: none $PAGE$-A $PAGE$-B $PAGE$-C Return to Learn C Table of Contents #: You cannot subtract delta from (s+from). #: The left and right hand sides of the assignment inside the while loop do not match in type. #: The left hand side has a value, the result of a computation, rather than refers to a location. #: