Thread: #intermediate codes

  1. #1
    Registered User
    Join Date
    May 2020

    #intermediate codes

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    void f(char *a, char *b, int c) {
        if (a < b && c>0) f(a++, b--, c - 1);
        *a = *a < *b ? *a : ++*b;
    void main(int argc, char *argv[]) {
        int c = atoi(argv[argc - 1]);
        char *p = argv[atoi(argv[3]) + 1],
            *q = p + strlen(p) - 1;
        f(p, q, c);
        printf("%s", p);
    Why the output is "bllisemilb" ?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2017
    It's a meaningless question since you haven't told us what your command line parameters were.
    If you want the truth to stand clear before you, never be for or against. - Sent-ts'an

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 07-31-2017, 10:14 AM
  2. Intermediate C programming
    By Acho Arnold in forum C Programming
    Replies: 5
    Last Post: 04-17-2013, 04:44 AM
  3. intermediate C book
    By jag in forum C Programming
    Replies: 1
    Last Post: 01-14-2005, 07:03 AM
  4. converting scan codes to ascii codes
    By stupid_mutt in forum C Programming
    Replies: 11
    Last Post: 01-25-2002, 04:06 PM
  5. intermediate Books
    By goodmonkie in forum A Brief History of
    Replies: 2
    Last Post: 10-20-2001, 05:36 PM

Tags for this Thread