Created
June 20, 2015 18:20
-
-
Save charleshkang/57fbb8410b19fbdfb457 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.m | |
// EveryOtherLetter | |
// | |
// Created by Charles Kang on 6/20/15. | |
// Copyright (c) 2015 Charles Kang. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
void uppercaseEveryOtherLetter(char arr[], int size) { | |
for (int i = 0; i < size; i+=2) { | |
printf("%d", i); | |
arr[i] = toupper(arr[i]); | |
} | |
} | |
int main(int argc, const char * argv[]) { | |
@autoreleasepool { | |
char string[] = "hello this is charles"; | |
int count = sizeof(string); | |
uppercaseEveryOtherLetter(string, count); | |
for (int i = 0; i < count; i++) { | |
printf("%c", string[i]); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment