Advertisement
5_2007-2008 Debugging and Error Handling #177698

The Array, the Pointer and the String tutorial.

The article teaches more about the way strings, arrays, pointers and pointer's pointers work. The article goes step by step and shows a few examples in which strings are manipulated.

AI

Yapay Zeka Özeti: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kaynak Kod
original-source
<b>Please download the attached zip file to read the tutorial from the .c file that way you can run it and play with it in the same time.<br>
All the tutorial is in the PointerPointer2.cpp file in the zip. Read, enjoy and vote. <br>
Thank you. <b>
<?php 
 $fontfamily = isset($fontfamily) ? $fontfamily : "Tahoma, Geneva, sans-serif"; 
 $defaultfontcolor = isset($defaultfontcolor) ? $defaultfontcolor : "#000000"; 
 $defaultbgcolor = isset($defaultbgcolor) ? $defaultbgcolor : "#FFFFFF"; 
 $todayfontcolor = isset($todayfontcolor) ? $todayfontcolor : "#FFFFFF"; 
 $todaybgcolor = isset($todaybgcolor) ? $todaybgcolor : "#CC0000"; 
 $monthcolor = isset($monthcolor) ? $monthcolor : "#333399"; 
 $relfontsize = isset($relfontsize) ? $relfontsize : "1"; 
 $cssfontsize = isset($cssfontsize) ? $cssfontsize : "7pt"; 
 $month = (isset($month)) ? $month : date("n",time()); 
 $textmonth = date("F",mktime(1,1,1,$month,1,$year)); 
 //if date("F",mktime(1,1,1,$month,1,$year)) doesn't work, then use this old implementation 
 //$monthnames = array("January","February","March","April","May","June","July","August","September","October","November","December"); 
 //$textmonth = $monthnames[$month - 1]; 
 $year = (isset($year)) ? $year : date("Y",time()); 
 $today = (isset($today))? $today : date("j", time()); // Make $today really big to avoid hilighting 
 $today = ($month == date("n",time()) && $year == date("Y",time())) ? $today : 32; //will only highlight today for this month & year 
 //this method of finding dates is old, but if date("t",mktime(1,1,1,$month,1,$year); doesn't work then use this 
// if ( (($month < 8) && ($month % 2 == 1)) || (($month > 7) && ($month % 2 == 0)) ) 
//  $days = 31; 
// if ( (($month < 8) && ($month % 2 == 0)) || (($month > 7) && ($month % 2 == 1)) ) 
//  $days = 30; 
// if ($month == 2) 
//  $days = (date("L",time())) ? 29 : 28; 
 $days = date("t",mktime(1,1,1,$month,1,$year)); 
 $dayone = date("w",mktime(1,1,1,$month,1,$year)); 
 $daylast = date("w",mktime(1,1,1,$month,$days,$year)); 
 $dayarray = array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); 
?> 
<table border="0" cellpadding="0" cellspacing="0" width="100%"> 
<tr> 
 <td bgcolor="<?php echo $defaultbgcolor ?>" colspan="7" valign="middle" align="center"><font color="<?php echo $monthcolor ?>" face="Arial, Helvetica, sans-serif" size="3"><b><?php echo $textmonth ?></b></font></td> 
</tr> 
<tr> 
<?php //printing the days of week 
  for($i=0; $i <= 6; $i++): 
   $width = ($i == 0 || $i == 6) ? "15%" : "14%"; 
   //use the css (default) or the html version (commented out) underneath if you want full compatibility 
  echo " <td valign=\"middle\" width=$width\" style=\"text-align:center; background:{$defaultbgcolor}; font:bold {$cssfontsize} {$fontfamily}; color:{$defaultfontcolor};\">$dayarray[$i]</td>\n"; 
  //echo " <td bgcolor=\"$defaultbgcolor\" valign=\"middle\" align=\"center\" width=\"$width\"><font color=\"$fontcolor\" face=\"$fontfamily\" size=\"$relfontsize\">$i</font></td>\n"; 
 endfor; 
 echo "</tr>\n"; //done printing the top row of days 
 $span1 = $dayone; 
 $span2 = 6 - $daylast; 
 for($i = 1; $i <= $days; $i++): 
  $dayofweek = date("w",mktime(1,1,1,$month,$i,$year)); 
  $width = ($dayofweek == 0 || $dayofweek == 6) ? "15%" : "14%"; //sets the col width 
  switch ($i): 
   case $today: //sets background color for today 
    $fontcolor = $todayfontcolor; 
    $bgcellcolor = $todaybgcolor; 
   break; 
    default: //sets background color for other days 
    $fontcolor = $defaultfontcolor; 
    $bgcellcolor = $defaultbgcolor; 
   break; 
  endswitch; 
//  if($i == putdayhere): #use this for *special* days of the month, can be set ahead as well w/ &&... 
//   $fontcolor = puthexcolorhere; 
//   $bgcellcolor = puthexcolorhere; 
//  endif; 
  if($i == 1 || $dayofweek == 0): 
   echo " <tr bgcolor=\"$defaultbgcolor\">\n"; 
   if($span1 > 0 && $i == 1) 
    echo " <td align=\"left\" bgcolor=\"$defaultbgcolor\" colspan=\"$span1\"><font face=\"null\" size=\"1\">&nbsp;</font></td>\n"; 
  endif; 
   
   //use the css (default) or the html version (commented out) underneath if you want full compatibility 
  echo " <td valign=\"middle\" width=$width\" style=\"text-align:center; background:{$bgcellcolor}; font-family:{$fontfamily}; color:{$fontcolor}; font-size:{$cssfontsize}\">$i</td>\n"; 
  //echo " <td bgcolor=\"$bgcellcolor\" valign=\"middle\" align=\"center\" width=\"$width\"><font color=\"$fontcolor\" face=\"$fontfamily\" size=\"$relfontsize\">$i</font></td>\n"; 
  if($i == $days && $span2 > 0) 
   echo " <td align=\"left\" bgcolor=\"$defaultbgcolor\" colspan=\"$span2\"><font face=\"null\" size=\"1\">&nbsp;</font></td>\n"; 
  if($dayofweek == 6 || $i == $days) 
   echo " </tr>\n"; 
 endfor; 
 echo "</table>\n"; 
?>
Upload
Orijinal Yorumlar (3)
Wayback Machine'den kurtarıldı