EmbeddedRelated.com
Forums

[AVR club] 2 dimensional array

Started by "rah...@yahoo.com [avrclub]" June 5, 2016
I want to send a 2 dimensional array to the function in C into codevision compiler, but I haven't been successful. I want to deliver 5 names to function.Could you help me?
My program:
Function definition:void Func_Show(char *str[5])
{}

Calling Function in main program:
    char *str[5]={"aaaaa","bbbbbbbbb","cccccccccccccc","ddd","eeeeeee" };    

    Func_Show(*str[5],chose);
Best regardsAli  
in CodeVision :void Func_Show(char *str){    do     {        SHOW(str) ;       str += strlen(str) + 1 ; 
    } while (*str) }
 char Msg[5][MaxLength]={"aaaaa","bbbbbbbbb","cccccccccccccc","ddd","eeeeeee\0" };// \0 add  extra EOS (end of string) (null terminated) to the end of last string, then if you find 2 EOS you know that it is the last string 
or you can define your messages as :  char Msg[]={"aaaaa\0Bbbbbbbbb\0cccccccccccccc\0ddd\0eeeeeee\0" }; bynary :    {0x61, 0x61, 0, 0x42, 0x62 ... 0x62, 0, 0x63, 0x63, 0, 0x64, 0x64, 0x64, 0x64, 0, 0x65, ..., 0x65, 0, 0}     
in the main :call  Func_Show(Msg) ;

On Sunday, June 5, 2016 5:01 AM, "rahmatoolah abedini r...@yahoo.com [avrclub]" wrote:

  I want to send a 2 dimensional array to the function in C into codevision compiler, but I haven't been successful. I want to deliver 5 names to function.Could you help me?
My program:
Function definition:void Func_Show(char *str[5])
{}

Calling Function in main program:
    char *str[5]={"aaaaa","bbbbbbbbb","cccccccccccccc","ddd","eeeeeee" };    

    Func_Show(*str[5],chose);
Best regardsAli   #yiv9753218663 -- #yiv9753218663ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv9753218663 #yiv9753218663ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv9753218663 #yiv9753218663ygrp-mkp #yiv9753218663hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv9753218663 #yiv9753218663ygrp-mkp #yiv9753218663ads {margin-bottom:10px;}#yiv9753218663 #yiv9753218663ygrp-mkp .yiv9753218663ad {padding:0 0;}#yiv9753218663 #yiv9753218663ygrp-mkp .yiv9753218663ad p {margin:0;}#yiv9753218663 #yiv9753218663ygrp-mkp .yiv9753218663ad a {color:#0000ff;text-decoration:none;}#yiv9753218663 #yiv9753218663ygrp-sponsor #yiv9753218663ygrp-lc {font-family:Arial;}#yiv9753218663 #yiv9753218663ygrp-sponsor #yiv9753218663ygrp-lc #yiv9753218663hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv9753218663 #yiv9753218663ygrp-sponsor #yiv9753218663ygrp-lc .yiv9753218663ad {margin-bottom:10px;padding:0 0;}#yiv9753218663 #yiv9753218663actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv9753218663 #yiv9753218663activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv9753218663 #yiv9753218663activity span {font-weight:700;}#yiv9753218663 #yiv9753218663activity span:first-child {text-transform:uppercase;}#yiv9753218663 #yiv9753218663activity span a {color:#5085b6;text-decoration:none;}#yiv9753218663 #yiv9753218663activity span span {color:#ff7900;}#yiv9753218663 #yiv9753218663activity span .yiv9753218663underline {text-decoration:underline;}#yiv9753218663 .yiv9753218663attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv9753218663 .yiv9753218663attach div a {text-decoration:none;}#yiv9753218663 .yiv9753218663attach img {border:none;padding-right:5px;}#yiv9753218663 .yiv9753218663attach label {display:block;margin-bottom:5px;}#yiv9753218663 .yiv9753218663attach label a {text-decoration:none;}#yiv9753218663 blockquote {margin:0 0 0 4px;}#yiv9753218663 .yiv9753218663bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv9753218663 .yiv9753218663bold a {text-decoration:none;}#yiv9753218663 dd.yiv9753218663last p a {font-family:Verdana;font-weight:700;}#yiv9753218663 dd.yiv9753218663last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv9753218663 dd.yiv9753218663last p span.yiv9753218663yshortcuts {margin-right:0;}#yiv9753218663 div.yiv9753218663attach-table div div a {text-decoration:none;}#yiv9753218663 div.yiv9753218663attach-table {width:400px;}#yiv9753218663 div.yiv9753218663file-title a, #yiv9753218663 div.yiv9753218663file-title a:active, #yiv9753218663 div.yiv9753218663file-title a:hover, #yiv9753218663 div.yiv9753218663file-title a:visited {text-decoration:none;}#yiv9753218663 div.yiv9753218663photo-title a, #yiv9753218663 div.yiv9753218663photo-title a:active, #yiv9753218663 div.yiv9753218663photo-title a:hover, #yiv9753218663 div.yiv9753218663photo-title a:visited {text-decoration:none;}#yiv9753218663 div#yiv9753218663ygrp-mlmsg #yiv9753218663ygrp-msg p a span.yiv9753218663yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv9753218663 .yiv9753218663green {color:#628c2a;}#yiv9753218663 .yiv9753218663MsoNormal {margin:0 0 0 0;}#yiv9753218663 o {font-size:0;}#yiv9753218663 #yiv9753218663photos div {float:left;width:72px;}#yiv9753218663 #yiv9753218663photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv9753218663 #yiv9753218663photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv9753218663 #yiv9753218663reco-category {font-size:77%;}#yiv9753218663 #yiv9753218663reco-desc {font-size:77%;}#yiv9753218663 .yiv9753218663replbq {margin:4px;}#yiv9753218663 #yiv9753218663ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv9753218663 #yiv9753218663ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv9753218663 #yiv9753218663ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv9753218663 #yiv9753218663ygrp-mlmsg select, #yiv9753218663 input, #yiv9753218663 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv9753218663 #yiv9753218663ygrp-mlmsg pre, #yiv9753218663 code {font:115% monospace;}#yiv9753218663 #yiv9753218663ygrp-mlmsg * {line-height:1.22em;}#yiv9753218663 #yiv9753218663ygrp-mlmsg #yiv9753218663logo {padding-bottom:10px;}#yiv9753218663 #yiv9753218663ygrp-msg p a {font-family:Verdana;}#yiv9753218663 #yiv9753218663ygrp-msg p#yiv9753218663attach-count span {color:#1E66AE;font-weight:700;}#yiv9753218663 #yiv9753218663ygrp-reco #yiv9753218663reco-head {color:#ff7900;font-weight:700;}#yiv9753218663 #yiv9753218663ygrp-reco {margin-bottom:20px;padding:0px;}#yiv9753218663 #yiv9753218663ygrp-sponsor #yiv9753218663ov li a {font-size:130%;text-decoration:none;}#yiv9753218663 #yiv9753218663ygrp-sponsor #yiv9753218663ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv9753218663 #yiv9753218663ygrp-sponsor #yiv9753218663ov ul {margin:0;padding:0 0 0 8px;}#yiv9753218663 #yiv9753218663ygrp-text {font-family:Georgia;}#yiv9753218663 #yiv9753218663ygrp-text p {margin:0 0 1em 0;}#yiv9753218663 #yiv9753218663ygrp-text tt {font-size:120%;}#yiv9753218663 #yiv9753218663ygrp-vital ul li:last-child {border-right:none !important;}#yiv9753218663
finally you can send what you want if you know the number of rows an colons , or you make structure with your parameters and pass its address to the function :   struct Type    {
      -----
    } VarName ;

  (Struct_Show struct Type * S){    ------
}
void main(){    ---    Struct_Show(VarName) ;    ---}

On Monday, June 6, 2016 1:47 AM, "Imad Ir i...@yahoo.com [avrclub]" wrote:

  in CodeVision :void Func_Show(char *str){    do     {        SHOW(str) ;       str += strlen(str) + 1 ; 
    } while (*str) }
 char Msg[5][MaxLength]={"aaaaa","bbbbbbbbb","cccccccccccccc","ddd","eeeeeee\0" };// \0 add  extra EOS (end of string) (null terminated) to the end of last string, then if you find 2 EOS you know that it is the last string 
or you can define your messages as :  char Msg[]={"aaaaa\0Bbbbbbbbb\0cccccccccccccc\0ddd\0eeeeeee\0" }; bynary :    {0x61, 0x61, 0, 0x42, 0x62 ... 0x62, 0, 0x63, 0x63, 0, 0x64, 0x64, 0x64, 0x64, 0, 0x65, ..., 0x65, 0, 0}     
in the main :call  Func_Show(Msg) ;

On Sunday, June 5, 2016 5:01 AM, "rahmatoolah abedini r...@yahoo.com [avrclub]" wrote:

  I want to send a 2 dimensional array to the function in C into codevision compiler, but I haven't been successful. I want to deliver 5 names to function.Could you help me?
My program:
Function definition:void Func_Show(char *str[5])
{}

Calling Function in main program:
    char *str[5]={"aaaaa","bbbbbbbbb","cccccccccccccc","ddd","eeeeeee" };    

    Func_Show(*str[5],chose);
Best regardsAli  

#yiv3116219317 -- #yiv3116219317ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv3116219317 #yiv3116219317ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv3116219317 #yiv3116219317ygrp-mkp #yiv3116219317hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv3116219317 #yiv3116219317ygrp-mkp #yiv3116219317ads {margin-bottom:10px;}#yiv3116219317 #yiv3116219317ygrp-mkp .yiv3116219317ad {padding:0 0;}#yiv3116219317 #yiv3116219317ygrp-mkp .yiv3116219317ad p {margin:0;}#yiv3116219317 #yiv3116219317ygrp-mkp .yiv3116219317ad a {color:#0000ff;text-decoration:none;}#yiv3116219317 #yiv3116219317ygrp-sponsor #yiv3116219317ygrp-lc {font-family:Arial;}#yiv3116219317 #yiv3116219317ygrp-sponsor #yiv3116219317ygrp-lc #yiv3116219317hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv3116219317 #yiv3116219317ygrp-sponsor #yiv3116219317ygrp-lc .yiv3116219317ad {margin-bottom:10px;padding:0 0;}#yiv3116219317 #yiv3116219317actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv3116219317 #yiv3116219317activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv3116219317 #yiv3116219317activity span {font-weight:700;}#yiv3116219317 #yiv3116219317activity span:first-child {text-transform:uppercase;}#yiv3116219317 #yiv3116219317activity span a {color:#5085b6;text-decoration:none;}#yiv3116219317 #yiv3116219317activity span span {color:#ff7900;}#yiv3116219317 #yiv3116219317activity span .yiv3116219317underline {text-decoration:underline;}#yiv3116219317 .yiv3116219317attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv3116219317 .yiv3116219317attach div a {text-decoration:none;}#yiv3116219317 .yiv3116219317attach img {border:none;padding-right:5px;}#yiv3116219317 .yiv3116219317attach label {display:block;margin-bottom:5px;}#yiv3116219317 .yiv3116219317attach label a {text-decoration:none;}#yiv3116219317 blockquote {margin:0 0 0 4px;}#yiv3116219317 .yiv3116219317bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv3116219317 .yiv3116219317bold a {text-decoration:none;}#yiv3116219317 dd.yiv3116219317last p a {font-family:Verdana;font-weight:700;}#yiv3116219317 dd.yiv3116219317last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv3116219317 dd.yiv3116219317last p span.yiv3116219317yshortcuts {margin-right:0;}#yiv3116219317 div.yiv3116219317attach-table div div a {text-decoration:none;}#yiv3116219317 div.yiv3116219317attach-table {width:400px;}#yiv3116219317 div.yiv3116219317file-title a, #yiv3116219317 div.yiv3116219317file-title a:active, #yiv3116219317 div.yiv3116219317file-title a:hover, #yiv3116219317 div.yiv3116219317file-title a:visited {text-decoration:none;}#yiv3116219317 div.yiv3116219317photo-title a, #yiv3116219317 div.yiv3116219317photo-title a:active, #yiv3116219317 div.yiv3116219317photo-title a:hover, #yiv3116219317 div.yiv3116219317photo-title a:visited {text-decoration:none;}#yiv3116219317 div#yiv3116219317ygrp-mlmsg #yiv3116219317ygrp-msg p a span.yiv3116219317yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv3116219317 .yiv3116219317green {color:#628c2a;}#yiv3116219317 .yiv3116219317MsoNormal {margin:0 0 0 0;}#yiv3116219317 o {font-size:0;}#yiv3116219317 #yiv3116219317photos div {float:left;width:72px;}#yiv3116219317 #yiv3116219317photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv3116219317 #yiv3116219317photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv3116219317 #yiv3116219317reco-category {font-size:77%;}#yiv3116219317 #yiv3116219317reco-desc {font-size:77%;}#yiv3116219317 .yiv3116219317replbq {margin:4px;}#yiv3116219317 #yiv3116219317ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv3116219317 #yiv3116219317ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv3116219317 #yiv3116219317ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv3116219317 #yiv3116219317ygrp-mlmsg select, #yiv3116219317 input, #yiv3116219317 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv3116219317 #yiv3116219317ygrp-mlmsg pre, #yiv3116219317 code {font:115% monospace;}#yiv3116219317 #yiv3116219317ygrp-mlmsg * {line-height:1.22em;}#yiv3116219317 #yiv3116219317ygrp-mlmsg #yiv3116219317logo {padding-bottom:10px;}#yiv3116219317 #yiv3116219317ygrp-msg p a {font-family:Verdana;}#yiv3116219317 #yiv3116219317ygrp-msg p#yiv3116219317attach-count span {color:#1E66AE;font-weight:700;}#yiv3116219317 #yiv3116219317ygrp-reco #yiv3116219317reco-head {color:#ff7900;font-weight:700;}#yiv3116219317 #yiv3116219317ygrp-reco {margin-bottom:20px;padding:0px;}#yiv3116219317 #yiv3116219317ygrp-sponsor #yiv3116219317ov li a {font-size:130%;text-decoration:none;}#yiv3116219317 #yiv3116219317ygrp-sponsor #yiv3116219317ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv3116219317 #yiv3116219317ygrp-sponsor #yiv3116219317ov ul {margin:0;padding:0 0 0 8px;}#yiv3116219317 #yiv3116219317ygrp-text {font-family:Georgia;}#yiv3116219317 #yiv3116219317ygrp-text p {margin:0 0 1em 0;}#yiv3116219317 #yiv3116219317ygrp-text tt {font-size:120%;}#yiv3116219317 #yiv3116219317ygrp-vital ul li:last-child {border-right:none !important;}#yiv3116219317